SkillSpector icon indicating copy to clipboard operation
SkillSpector copied to clipboard

YR4 privilege_escalation_tools matches "pspy" inside base64 data (nocase literal with no word boundary)

Open forrestsatterfield opened this issue 5 days ago • 1 comments

Summary

YR4 rule privilege_escalation_tools (HIGH, confidence 0.75) matches pSpY inside base64 data. The $pspy string is a four-character case-insensitive literal with no word boundaries, so it matches at random in any base64, minified or hash-like text. On random base64 that works out to roughly one match per MiB (4 positions, 2 of 64 symbols each: (2/64)^4 ≈ 9.5e-7 per offset).

I hit this scanning a Claude Code plugin whose eval runner had written a results JSON and an HTML report with embedded images. Each file got one HIGH "Privilege escalation tools" finding.

Environment

  • SkillSpector v2.13.7 (main at 636e4293)
  • skillspector scan <dir> --no-llm --format json (static only)
  • Windows 11

Reproduction

yr4/SKILL.md:

---
name: yr4
description: Minimal reproducer.
---

# Logo

See `assets/logo.json`.

yr4/assets/logo.json (a base64 excerpt taken from the real file):

{"logo": "data:image/png;base64,To0ND0Odk95alVG8jYb4sLIzHI5qpaC8qKo7IJla6AOLwt/GdIPpVq7fHNyopSpY/MnBodKE0YxYoiPiOiptFi4ejRSiL1a3KI3HgZu4brZIUFnwQIVccOt9vO3G"}
score 18 LOW SAFE
  YR4 HIGH 0.75 assets/logo.json:1 | YARA rule 'privilege_escalation_tools': Privilege escalation tools and … | 'pSpY'

Cause

src/skillspector/yara_rules/hacktools.yar, rule privilege_escalation_tools:

$pspy          = "pspy" nocase

$linpeas, $winpeas and $dirty_cow are the same kind of bare nocase literal. They're longer, so random matches are much rarer, but they still match inside identifiers.

Expected

No finding for pspy inside a base64 run or another identifier. Something like this (checked with yara-python):

$pspy = /(^|[^A-Za-z0-9+_-])pspy((32|64)s?)?([^A-Za-z0-9+_-]|$)/ nocase
Input Matches
NyopSpY/MnBod (base64) no
xpspyx no
./pspy64 -pf -i 1000 yes
./pspy64s, pspy32s yes
run pspy to watch yes
https://github.com/DominicBreuker/pspy/releases yes

/ stays an allowed boundary so paths and URLs still match. That means base64 with /pspy/ would still hit, but that is about 4,000 times rarer than a bare four-letter match. The same fix as #605 ($rop_chain on impl Drop) and #487 (php_webshell_known on "behindert").

forrestsatterfield avatar Nov 29 '26 08:11 forrestsatterfield

I would like to take this one. The bare nocase literal for pspy (and the same shape for linpeas, winpeas and dirty_cow) matches inside base64 and identifiers, which is the same class as the fixes for #605 and #487. I will reproduce it on current main first, then send a PR with word-boundary patterns plus regression tests covering the base64 case and the path and URL cases that should still fire.

Varshith-Kali avatar Nov 29 '26 16:11 Varshith-Kali