-
Notifications
You must be signed in to change notification settings - Fork 7
feat: add enhanced exploit detection patterns for CVE-2025-55182 #1
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change | ||||||||||||||||||||||||||||
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
|
|
@@ -29,6 +29,20 @@ const EXPLOIT_PATTERNS = [ | |||||||||||||||||||||||||||||
| severity: 'high' as const, | ||||||||||||||||||||||||||||||
| description: 'Prototype pollution attempt', | ||||||||||||||||||||||||||||||
| }, | ||||||||||||||||||||||||||||||
| // Object.prototype.then pollution (CVE-2025-55182 exploit technique) | ||||||||||||||||||||||||||||||
| { | ||||||||||||||||||||||||||||||
| name: 'then_pollution', | ||||||||||||||||||||||||||||||
| pattern: /prototype\s*\.\s*then|\.then\s*=/i, | ||||||||||||||||||||||||||||||
| severity: 'high' as const, | ||||||||||||||||||||||||||||||
| description: 'Object.prototype.then pollution attempt', | ||||||||||||||||||||||||||||||
| }, | ||||||||||||||||||||||||||||||
| // _prefix property injection (CVE-2025-55182 exploit technique) | ||||||||||||||||||||||||||||||
| { | ||||||||||||||||||||||||||||||
| name: 'prefix_injection', | ||||||||||||||||||||||||||||||
| pattern: /"_prefix"\s*:/i, | ||||||||||||||||||||||||||||||
| severity: 'high' as const, | ||||||||||||||||||||||||||||||
| description: 'Potential _prefix property injection', | ||||||||||||||||||||||||||||||
| }, | ||||||||||||||||||||||||||||||
|
Comment on lines
+32
to
+45
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. 🧩 Analysis chain🌐 Web query:
💡 Result: Short summary — CVE-2025-55182 is a critical (CVSS 10.0) unauthenticated remote‑code‑execution vulnerability in the React Server Components (RSC) "Flight" handling. An attacker can send a crafted HTTP RSC payload to vulnerable servers and achieve RCE without authentication. Immediate patching is required. [1][2][3] Key facts
Immediate actions (recommended)
References If you want, I can: (A) check a specific project (package.json / lockfile) for vulnerable react-server-dom versions, or (B) fetch the exact Next.js versions you must upgrade from/to for your environment. Which would you prefer? 🏁 Script executed: #!/bin/bash
# Search for test files covering these patterns
find . -type f \( -name "*test*" -o -name "*spec*" \) \( -name "*.ts" -o -name "*.js" \) | head -20
# Search for references to these patterns in tests
rg -i "then_pollution|prefix_injection" --type ts --type js
# Check the detector.ts file context
fd -name "detector.ts" -type fRepository: gensecaihq/react2shell-scanner Length of output: 783 🏁 Script executed: #!/bin/bash
# Check middleware test file for these pattern tests
rg "then_pollution|prefix_injection" test/unit/middleware.test.ts -A 5 -B 2
# View the detector.ts file to understand implementation
cat src/middleware/detector.tsRepository: gensecaihq/react2shell-scanner Length of output: 5839 🌐 Web query:
💡 Result: Short summary — what "then pollution" / "prototype.then" is and how it was used against CVE-2025-55182 (React RSC Flight):
Key references (read for payloads and walk‑throughs):
If you want, I can:
🌐 Web query:
💡 Result: Short answer: Yes — CVE-2025-55182’s exploit chain abuses a crafted _response object (including a controlled _prefix) so the RSC deserializer ends up calling response._formData.get(response._prefix + id), which can be used to invoke the Function constructor and achieve RCE. Patch immediately. [1][2][3] Details & references:
Action: upgrade react-server-dom-webpack / -parcel / -turbopack to the patched versions (19.0.1, 19.1.2, 19.2.1 or later) and update affected frameworks (Next.js patched releases) immediately; if you cannot patch, block/limit Server Function endpoints and apply WAF rules. See React advisory and national CERT advisories for recommended versions and mitigation steps. [1][4][5] Sources: 🏁 Script executed: #!/bin/bash
# Check the middleware test file for coverage of these patterns
cat test/unit/middleware.test.ts | head -200Repository: gensecaihq/react2shell-scanner Length of output: 6565 🏁 Script executed: #!/bin/bash
# Search for any tests that might test detector patterns
rg -i "detectExploitPatterns|then_pollution|prefix_injection" test/unit/middleware.test.ts -A 3 -B 1Repository: gensecaihq/react2shell-scanner Length of output: 2285 Add tests for The test suite has comprehensive coverage for most exploit patterns but lacks explicit tests for the two CVE-2025-55182-specific patterns. Add test cases for it('should detect then pollution attempts', () => {
const payload = 'Object.prototype.then = function() {}';
const result = detectExploitPatterns(payload);
expect(result.detected).toBe(true);
expect(result.patterns).toContain('then_pollution');
expect(result.severity).toBe('high');
});
it('should detect _prefix injection', () => {
const payload = '{"_prefix": "malicious"}';
const result = detectExploitPatterns(payload);
expect(result.detected).toBe(true);
expect(result.patterns).toContain('prefix_injection');
expect(result.severity).toBe('high');
});🤖 Prompt for AI Agents
Comment on lines
+39
to
+45
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Pattern may be bypassed with different quote styles. The pattern only matches
Consider a more flexible pattern: {
name: 'prefix_injection',
- pattern: /"_prefix"\s*:/i,
+ pattern: /["']?_prefix["']?\s*:/i,
severity: 'high' as const,
description: 'Potential _prefix property injection',
},This matches 📝 Committable suggestion
Suggested change
🤖 Prompt for AI Agents |
||||||||||||||||||||||||||||||
| // Malformed module references | ||||||||||||||||||||||||||||||
| { | ||||||||||||||||||||||||||||||
| name: 'malformed_module_ref', | ||||||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||||||
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Overly broad pattern may cause false positives.
The second alternation
\.then\s*=will match any assignment to a.thenproperty, not just prototype pollution. For example,promise.then = someFuncorobj.then = valuewould trigger this pattern even though they're not prototype pollution attempts.Consider making the pattern more specific to actual prototype pollution vectors:
{ name: 'then_pollution', - pattern: /prototype\s*\.\s*then|\.then\s*=/i, + pattern: /(Object|constructor)\s*\.\s*prototype\s*\.\s*then|__proto__\s*\.\s*then|\[\s*["']__proto__["']\s*\]\s*\.\s*then/i, severity: 'high' as const, description: 'Object.prototype.then pollution attempt', },This revised pattern targets:
Object.prototype.thenorconstructor.prototype.then__proto__.then["__proto__"].then(bracket notation)📝 Committable suggestion
🤖 Prompt for AI Agents