You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
Detection gap: loader-chain walker overflow drops dataflow correlation to a regex fallback #88
Missed detection (should have been flagged, wasn't)
Package name and version
Synthetic pattern, no real package. Found during the security audit hardening (#84); listed as a follow-up in ADR-0056.
Expected vs actual verdict
native-payload-loader correlates a read, decode, write and launch chain through the acorn AST, with binding-resolved primitives and scoped taint (invariant 8). A file that also contains a very deep expression, for example tens of thousands of chained member accesses, overflows acorn-walk's recursive walk.
#84 maps that overflow to a walkOverflow flag and falls back to name matching:
The file is still rated critical when all four primitive names appear.
A chain written in a form the regex fallback does not recognise drops to high or below.
The fallback cannot tell a correlated chain from four unrelated mentions, so a benign overflowing file that mentions all four names is also rated critical.
The pattern
An attacker pads a correlated loader file with a deep expression (inside try { … } catch {} so it never runs) so that the dataflow analysis gives up. The chain is then written in a form the fallback misses, for example renamed primitives reached through an intermediate helper.
Suggested approach
Replace the recursive walk.ancestor in packages/core/src/detect/loader-chain.ts with an iterative walk using an explicit stack, keeping the same visit order and ancestor list. Then a deep expression costs time, not a stack overflow, and the full dataflow analysis always runs.
Remove the walkOverflow regex fallback (or keep it only for genuine parse failures).
Bound the work by node count, so the walk stays linear and deterministic.
Tests:
the padded correlated chain stays critical with renamed and helper-routed primitives;
a padded benign file that mentions the four names is not critical;
Activity