๐ฅ 4-Step API Testing Methodology
Advanced API Vulnerability Discovery Use Case: Bug Bounty & API Security Testing
1๏ธโฃ Find Sensitive API Endpoints
Target endpoints that commonly leak sensitive data:
- User PII (emails, phone numbers, addresses)
- Financial data (transactions, balances)
- Authentication tokens & session data
- Internal system information
- Admin-level data in user endpoints
Common sensitive endpoints
/api/v1/users/[ID]
/api/admin/config
/api/internal/metrics
/api/orders/[ID]
/api/transactions
/api/profile/private
2๏ธโฃ Cache Headers Analysis
Check response headers for caching indicators:
Cache-Control: public, max-age=3600
โ CACHEDCF-Cache-Status: HIT
โ Cloudflare cachedX-Cache: HIT
โ Generic cache hitAge: 300
โ 5 minutes in cacheETag: "abc123"
โ Entity tag for cache validationVia: 1.1 varnish
โ Proxy caching
If cached โ try Web Cache Deception:
Legitimate: /api/users/me/profile
Deception: /api/users/me/profile.css
Deception: /api/users/me/profile/
3๏ธโฃ HTTP Method Changing
Bypass auth/validation with method switching. Examples:
GET /api/admin/users โ 403 Forbidden
POST /api/admin/users โ 200 OK + user list
GET /api/config โ 404 Not Found
HEAD /api/config โ 200 OK
POST /api/search โ 403 Forbidden
PUT /api/search โ 200 OK + results
4๏ธโฃ Array-Based IDOR Testing
When you find /api/users/123
test these array/IDOR patterns:
/api/users/[123,124]
/api/users/123,124
/api/users/123&124
/api/users/?id[]=123&id[]=124
/api/users/?ids=123,124
/api/users/?user_ids=123,124
/api/batch/users?ids=123,124
๐ฏ Real-World Attack Chain (Example)
- Discover endpoint
/api/v1/users/456
- Check headers โ
X-Cache: HIT
,max-age=300
- Change
GET
toPOST
โ bypass rate limiting - Test array IDOR โ
/api/v1/users/[456,457,458]
Result: Mass user data leakage + cached responses
๐ก Defense Recommendations
- Consistent Authorization โ Apply same checks across all HTTP methods
- Input Validation โ Reject array parameters unless explicitly allowed
- Cache Control โ Use
Cache-Control: private
for sensitive data - API Schema Enforcement โ Validate against OpenAPI specification
- Audit Logging โ Monitor for unusual parameter patterns
๐ก Pro Testing Tips
- Use Burp's "Change Request Method" extension
- Automate with tools like
katana
orffuf
for endpoint discovery - Always test both authenticated and unauthenticated contexts
- Combine techniques (cache analysis + method change + IDOR) for maximum impact
๐ Follow @cybersecplayground for advanced API hacking techniques! Like & Share if you found your first IDOR with this! ๐ฐ
#APISecurity #BugBounty #IDOR #WebCacheDeception #CyberSecurity #APITesting #Hacking #SecurityResearch