Skip to content

VNX-1285: Improper Validation of Specified Index, Position, or Offset in Input

A position the client chose is used to index a list or array with no bounds check, so a negative value silently selects from the end (Python), an out-of-range value raises or yields undefined, and the client can read or remove an element it was never offered. Reported in Python: int(...) of a Flask/Django/DRF request value (request.args/form/values/json/GET/POST/data/query_params/view_args) used as a subscript x[v], or as the position of .pop(v)/.insert(v, ...), inline or through a variable assigned from it in the 15 lines above. JavaScript/TypeScript: parseInt/Number/parseFloat/unary + of req.body/query/params, or a req field named index, idx, pos, position, offset, slot, choice, row or column, used as a subscript x[v] or as the position of .splice(v, ...)/.at(v)/.charAt(v), inline, through a variable assigned in the 15 lines above, or through a position-named field destructured from the request (const { index } = req.body). Not reported: a comparison of the value (<, <=, >, >=, or a check against len()/.length) between the read and the use, slices (rows[offset:offset+20], .slice()), lookups keyed by a string (users[req.params.id], THEMES[name]), and text in comments and strings. Upper-bound-only checks are reported by VNX-839.

Updated 02 Nov 2026Checked against cli@de9b52a
Field Value
Rule ID VNX-1285
Severity Medium
SARIF level warning
Kind sast
Languages JavaScript / TypeScript, Python
CWE CWE-1285
CAPEC CAPEC-66
ATT&CK T1190
CWSS vector CWSS:1.0/TI:M/AP:RU/AL:S/IC:N/FC:LT/RP:RU/RL:S/AV:L/AS:N/IN:A/SC:A/BI:M/DI:H/EX:M/EC:N/P:C
Tags improper-validation-of-specified-index bounds cwe-1285
Source internal/sast/rules/vnx-1285.rego

Overview

VNX-1285 maps to CWE-1285: Improper Validation of Specified Index, Position, or Offset in Input.

Why This Matters

A position from the request used directly as a list index lets the client pick any element. In Python a negative index silently counts from the end. An out-of-range index raises an error or yields undefined, and .pop()/.splice() can remove an element the client was never offered.

What Gets Flagged

idx = int(request.args.get("index", 0))
return SLIDES[idx]

job = JOBS[int(request.GET["pos"])]
const i = parseInt(req.params.index, 10);
res.json(items[i]);

tracks.splice(+req.body.position, 1);

Not flagged: an index checked against 0 and len()/.length before use, slices (rows[offset:offset + 20], .slice()), lookups keyed by a string (users[req.params.id]).

Remediation

  1. Check 0 <= index < len(items) (or index >= 0 && index < items.length) before indexing, and return 400/404 otherwise.
  2. Prefer looking records up by an identifier rather than by position.

References

Suppressing this rule

Put a nosec comment on the line, or on line 1 to cover the whole file. Use the comment marker of the file’s language (#, //, -- or ;):

# nosec vnx-1285
// nosec vnx-1285

Or record an ignore rule: vulnetix ignore add --rule vnx-1285 --reason "...". See Suppressing findings.

Edit this pageSources: cli/internal/sast/rules/vnx-1285.rego, cli/internal/sast/docs/vnx-1285.md
esc
↑ ↓ move↵ openSearches in your browser. A key like autonomy.max or a code like threshold_required jumps straight to it.