Repository navigation
fix(yara): require a browser cookie-store path in info_stealer - #752
Conversation
rng1995
left a comment
There was a problem hiding this comment.
[SkillSpector Review]
@elliottwaves-20 thank you for tracing the #751 false positive to the unbounded $browser_cookies string, and for testing benign prose, the real cookie-store paths and the store-first code forms.
Value and readiness
This fixes a real HIGH YR1 false positive that blocks documentation-only skills. It also closes the gap where the old pattern missed the usual browser-first store paths. The approach is right, but the PR isn't ready yet, for two reasons. The branch now conflicts with main. And the new $cookies_browser string still fires on a common kind of prose, which is the same false-positive class this PR fixes.
Material findings
-
Blocker:
src/skillspector/yara_rules/malware.yar.b64conflicts withmain(GitHub reportsCONFLICTING). #608 changed theransomware_behaviorstrings aboveinfo_stealer, so every base64 line after that point differs and git can't merge the two encodings. Please rebase, apply theinfo_stealerchange tomain's decoded rules, and re-encode. The test file merges cleanly. -
Blocker: the trailing class of
$cookies_browser,[\\\/'\x22(], accepts an apostrophe, so an English possessive counts as code context. Both of these still match, so a cookie or auth doc still gets HIGHYR1and a blocking verdict, as in #751:Third-party cookies are blocked by Chrome's tracking protection.Session cookies are dropped by Firefox's Enhanced Tracking Protection.
One fix that keeps
"edge",'chrome'and every current fixture: count a quote only when it encloses the browser name, as in['\x22](chrome|...|firefox)['\x22]. Keep[^a-z](...)(_|\.\w|[\\\/(])for identifiers and paths. Please add both sentences to_COOKIE_PROSE(tests/nodes/analyzers/test_static_yara.py:633-641). -
Optional:
$browser_cookiesallows 1-4 separator characters, so the spaced pathlib formPath.home() / "AppData" / "Local" / "Google" / "Chrome" / "User Data" / "Default" / "Network" / "Cookies"matches neither new string. Here" / "is five characters, andCookiescomes last.mainmisses this too, so it isn't a regression. It is the common Python spelling, though, so{1,5}and a fixture would make the "browser first" coverage hold. -
Optional: the PR body says nothing
maincaught is lost. That is true for the six tested forms only. Store-first code where the browser is followed by)or], or sits more than 80 characters afterCookies, matched before and no longer does. Examples areget_cookies(chrome)andfind ~ -name Cookies -path '*chrome*'. That may be a fair price for precision, but please say so in the body, or add)to the follow set and recheck the prose corpus.
PIC tradeoffs
$firefox_cookies (cookies\.sqlite) is a bare-token string, like wallet.dat and ntds.dit. Any document that names Firefox's cookie store will now get HIGH YR1, for example a yt-dlp or browser-automation skill README. That is consistent with this rule's style, but the PIC should confirm it.
Verification and gaps
- I decoded the merge-base, head and current-
maincopies ofmalware.yar.b64withbase64 -dand diffed them.- The PR changes only
info_stealer, replacing one string with four. maindiffers only in the ransomware strings.git merge-treeconfirms the conflict is limited to the.b64file.
- The PR changes only
- I decoded the 12 base64 test fixtures. I traced them, the six prose lines and the examples above through the four regexes by hand.
- Per instructions, I didn't run the rule, YARA or the tests. All 6 CI checks passed at
345d34a.
345d34a to
db2c857
Compare
|
@rng1995 I addressed all four points. The branch is rebased onto main (b07f181).
Verification (Windows):
🤖 Generated with Claude Code |
rng1995
left a comment
There was a problem hiding this comment.
[SkillSpector Review]
Value and readiness
Ready on this head. The previous possessive-prose blocker is fixed, the requested path fixture improvements are present and GitHub reports the branch mergeable.
Material findings
No new or still-open required changes found. The earlier quote issue is closed by requiring a browser-enclosing quote pair; both possessive sentences and the Chrome/Edge prose control are in the tests. Decoded comparison confirms unrelated ransomware changes are preserved, resolving the earlier encoded-file conflict.
PIC tradeoffs
Accept the documented precision tradeoff: bare cookies.sqlite remains a HIGH signature, and store-first browser identifiers followed only by ) or ] or separated by more than 80 characters lose this one signature. These limitations are explicit and were optional in the previous review; the browser-first artifact paths gain coverage.
Verification and gaps
Reviewed the complete diff, description, linked issue material, all previous reviews/comments/replies and pinned-head surrounding source at db2c85744fa935cdac244e48c79077970a8a2596. Decoded base/head as data and confirmed only info_stealer strings differ. Read all prior review/reply material, all encoded fixtures and the prose controls; verified the five-character separator, quoted/dashed path and glob follow-set changes. GitHub reports changes: SUCCESS, lint: SUCCESS, test-unit: SUCCESS, OpenCode TypeScript Tests: SUCCESS, DCO Check: SUCCESS, docker-smoke: SUCCESS. No contributor code, tests, imports, build steps or scanner invocations were executed during this review.
$browser_cookies matched /Cookies.*(chrome|firefox|edge|opera)/ across a whole line, so documentation naming cookies and, later on the line, a browser or Edge Functions raised a HIGH info_stealer finding. Require a browser profile path that ends in the cookie store instead, and add the Opera and Firefox store forms. Every other string of the rule is unchanged. Fixes NVIDIA#751 Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Signed-off-by: elliottwaves-20 <pail1217@web.de>
The first change only matched the browser-before-store order, so code such as sqlite3.connect(chrome_profile + "/Cookies") that the previous pattern caught no longer matched. Add $cookies_browser for the store-first order with a browser name that is part of an identifier, path or string, and let $browser_cookies accept an identifier suffix (CHROME_DIR). Regression tests cover six such code forms and two more prose sentences. Refs NVIDIA#751 Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Signed-off-by: elliottwaves-20 <pail1217@web.de>
$cookies_browser accepted an apostrophe after the browser name, so English
possessives such as "blocked by Chrome's tracking protection" still gave
HIGH YR1. A quote now counts only when it encloses the browser name
("edge", 'chrome'). A slash or backslash after the browser name counts
only when a path character or quote precedes it (/chromium/,
google-chrome/, "chromium/), so a browser list such as "Chrome/Edge"
in prose no longer matches. Identifiers keep the (_|\.\w|[(]) follow
set, which now also accepts a glob star (-path '*chrome*').
$browser_cookies allows up to five separator characters, so the spaced
pathlib form Path.home() / "Chrome" / "User Data" / ... / "Cookies"
matches.
Refs NVIDIA#751
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Signed-off-by: elliottwaves-20 <pail1217@web.de>
db2c857 to
d258a90
Compare
|
Rebased onto main ( 🤖 Generated with Claude Code |
rng1995
left a comment
There was a problem hiding this comment.
[SkillSpector Review]
Value and readiness
Ready for code approval at d258a90f3fa662e87045f9a7732db02df447b9c7. The rebase resolves the encoded-rule conflict while preserving the previously approved cookie-rule behavior and the newer ransomware signatures. All six hosted checks pass. The unresolved review conversation still needs disposition before merge.
Material findings
No new or still-open required code changes found. Decoding base/head as data shows that only the info_stealer strings differ; every unrelated rule, including ransomware_behavior_multiline from #860, is preserved. The complete info_stealer rule is byte-identical to approved head db2c8574, and all 82 added test lines are unchanged.
Verified every prior point: browser-enclosing quotes prevent the two possessive-prose false positives; both sentences and the Chrome/Edge prose control remain in _COOKIE_PROSE; five-character separators retain spaced pathlib paths; quoted/dashed browser path segments and the store-first glob remain covered. The author explicitly documents the remaining store-first limitations. The original inline issue is resolved in source although its conversation remains open.
PIC tradeoffs
The documented precision tradeoffs remain: bare cookies.sqlite is still a HIGH signature, while store-first browser identifiers followed only by ) or ], at end of line, or beyond the 80-character span lose this one signature. Browser-first profile paths gain coverage. These limitations were explicit and optional in the earlier approval.
Verification and gaps
Read the complete two-file diff, linked #751, all earlier reviews/replies, the new rebase explanation and pinned loader/test context. Decoded all 16 added code/path fixtures as inert data, checked the nine prose controls, and compared the decoded rules against current base 54921c8c and the prior approved source. Hosted checks: changes, lint, test-unit, OpenCode TypeScript Tests, DCO Check and docker-smoke all SUCCESS. GitHub reports MERGEABLE / BLOCKED; the unresolved conversation remains a separate merge gate. Static review only: no contributor code, YARA rules, tests, imports, builds or scanner invocations were executed.
rng1995
left a comment
There was a problem hiding this comment.
[SkillSpector Review]
Value and readiness
Approval remains appropriate at the unchanged reviewed head. The author has now resolved the last conversation, removing yesterday's thread gate.
Material findings
No new or still-open required changes found. Rechecked the resolved possessive-prose finding against the prior exact-head assessment: quoted browser/store boundaries and the corresponding prose/path controls remain present. The unchanged approved head preserves every unrelated rule, including the ransomware signatures. Thread resolution is supported by the already verified source fix; resolution alone was not treated as proof.
PIC tradeoffs
The previously documented bounded cookie-path recognition tradeoffs remain unchanged; no new product decision identified.
Verification and gaps
Read the current full two-file diff, marked review history, resolution/reply state and prior pinned decoded rules/test proof. Current head d258a90 matches the exact commit fully assessed yesterday. All six hosted checks succeeded; final merge gates are checked separately. No contributor code, tests, snippets, imports, builds, model calls or scanner invocations were executed.
Reviewed head: d258a90f3fa662e87045f9a7732db02df447b9c7.
* fix(yara): require a browser cookie-store path in info_stealer $browser_cookies matched /Cookies.*(chrome|firefox|edge|opera)/ across a whole line, so documentation naming cookies and, later on the line, a browser or Edge Functions raised a HIGH info_stealer finding. Require a browser profile path that ends in the cookie store instead, and add the Opera and Firefox store forms. Every other string of the rule is unchanged. Fixes #751 Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Signed-off-by: elliottwaves-20 <pail1217@web.de> * fix(yara): keep info_stealer matches on code that names the store first The first change only matched the browser-before-store order, so code such as sqlite3.connect(chrome_profile + "/Cookies") that the previous pattern caught no longer matched. Add $cookies_browser for the store-first order with a browser name that is part of an identifier, path or string, and let $browser_cookies accept an identifier suffix (CHROME_DIR). Regression tests cover six such code forms and two more prose sentences. Refs #751 Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Signed-off-by: elliottwaves-20 <pail1217@web.de> * fix(yara): count a quote in info_stealer only around the browser name $cookies_browser accepted an apostrophe after the browser name, so English possessives such as "blocked by Chrome's tracking protection" still gave HIGH YR1. A quote now counts only when it encloses the browser name ("edge", 'chrome'). A slash or backslash after the browser name counts only when a path character or quote precedes it (/chromium/, google-chrome/, "chromium/), so a browser list such as "Chrome/Edge" in prose no longer matches. Identifiers keep the (_|\.\w|[(]) follow set, which now also accepts a glob star (-path '*chrome*'). $browser_cookies allows up to five separator characters, so the spaced pathlib form Path.home() / "Chrome" / "User Data" / ... / "Cookies" matches. Refs #751 Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Signed-off-by: elliottwaves-20 <pail1217@web.de> --------- Signed-off-by: elliottwaves-20 <pail1217@web.de> Co-authored-by: Claude Opus 5.5 <noreply@anthropic.com> (cherry picked from commit 988effa) Signed-off-by: Narendran Raghavan <nraghavan@nvidia.com>
Fixes #751.
The built-in
info_stealerrule matched$browser_cookies = /Cookies.*(chrome|firefox|edge|opera)/ nocaseacross a whole line. Because the condition isany of them, documentation that names cookies and, later on the same line, a browser or "Edge Functions" raised a HIGHYR1finding. The supabase skill description in #751 is one example.This change keeps the rule's intent and requires code context. It matches one of these:
chrome_profile,opera.profile), a path segment (/chromium/,google-chrome/), a quoted string ("edge"), or a glob ('*chrome*').This way, code that names the store first is still caught. The change also adds the Opera (
Opera Stable/Opera GX Stable) and Firefox (cookies.sqlite) store forms. All other strings of the rule are unchanged.The previous pattern also needed
Cookiesbefore the browser name. The usual path forms put the browser first andCookieslast, so they did not match unless something else followed on the line. The new strings cover those forms.A quote counts only when it encloses the browser name. A slash or backslash after the browser name counts only after a path character or a quote. So prose such as
blocked by Chrome's tracking protectionorCookies: Chrome/Edge supporteddoes not match.Known trade-offs
)or](get_cookies(chrome)), a browser name at the end of the line, and a browser name more than 80 characters afterCookies.)is left out on purpose, because(Chrome)is a common parenthetical in prose. A real stealer usually also names the store path, which$browser_cookiescatches.cookies.sqliteis a bare token, likewallet.datandntds.ditin this rule. A document that names the Firefox cookie store gets HIGHYR1.Tests
tests/nodes/analyzers/test_static_yara.py, following the #489 pattern:test_info_stealer_ignores_cookie_prose: the False positive: info_stealer$browser_cookiesmatches prose that mentions cookies and Edge on one line #751 description and eight short documentation sentences, including two possessives and a browser list with a slash.test_info_stealer_matches_browser_cookie_store_paths: Chrome/Edge on Windows, Brave on Linux, Chrome on macOS, Opera, Firefox, and the spaced pathlib form. The fixtures are base64-encoded, as for the webshell families.test_info_stealer_matches_code_naming_the_store_first: nine code forms that name the store first, then the browser.test_info_stealer_matches_cookie_store_path_next_to_prose: a store path after benign prose in one file.Validation
pytest tests/nodes/analyzers/test_static_yara.py: 379 passed.main, theinfo_stealertests give 18 failed, 8 passed. The 8 that pass are seven store-first code forms and the mixed case. The other two code forms (os.path.join(CHROME_DIR, "Default", "Cookies")and a"chromium/"path segment) are newly caught.mainmatchedrequests/cookies.py.mainon this machine, none in YARA.ruff checkandruff format --checkon the changed test file: clean.🤖 Generated with Claude Code