Local Testing
Overview
With prioritized shortlist of potentially vulnerable functions, confirm or deny vulnerabilities through testing and local debugging.
Approach: Similar to developer debugging - vulnerabilities are essentially 'issues' in code.
Local Testing Phases
Backend Replication
β
Testing
β
ExploitationPhase 1: Backend Replication
Goal
Set up test server that closely resembles production backend.
Scenarios
Team provides replica server
Skip to testing
No server provided
Set up own test server
Difficulty Factors
Requirements doc
Available
Not documented
Dependencies
Listed (package.json)
Must identify manually
External connections
Documented
Need to discover
Database schema
Provided
Must reverse engineer
Example: Node.js Application
External Connections
Consider:
Database connections
API endpoints
Authentication services
File storage
Cache servers
Note: Cost increases with poor documentation - more time to replicate.
Phase 2: Testing
Goals
Trigger target function
Find how to reach the vulnerable code
Control input
Understand how input reaches/affects function
Triggering the Function
Function may not be directly accessible:
Only triggered under certain conditions
Requires specific user role
Needs specific application state
Process:
Identify entry points
Map request flow to target function
Test different conditions
Debug to understand triggers
Tracing Input
At each stage, monitor:
How input changes
What filtering/validation occurs
What transformations apply
Testing Techniques
Breakpoints
Pause execution at key points
Logging
Track variable values
Request modification
Test different inputs
Step-through debugging
Follow execution path
Debugging Tools by Platform
PHP
Xdebug, var_dump()
Python
pdb, print(), PyCharm debugger
Node.js
node --inspect, console.log()
Java
IDE debugger, System.out.println()
.NET
Visual Studio debugger
Phase 3: Exploitation
Goal
Achieve basic exploitation to confirm vulnerability exists.
NOT Required at This Stage
Fully operational exploit
Bypassing WAF/filters
Overcoming blind exploitation challenges
Production-ready script
Required at This Stage
Basic confirmation function is vulnerable
Proof it can be exploited
Safe Confirmation Payloads
Command Injection
touch /tmp/test or ping -c 1 localhost
SQL Injection
Execute query, check logs
XSS
Simple alert(1)
File Read
Read known file
SSRF
Request to internal endpoint
Example: Command Injection Test
Example: SQL Injection Test
Why Basic Exploitation First?
Decision Point
After Testing
Confirmed exploitable
Move to PoC phase
Not exploitable
Reassess priority, move to next target
Uncertain
More testing/analysis needed
Reducing Priority
If confirmed vulnerable but not exploitable:
Reduces probability of damage
Reduces overall risk rating
May still report as finding
Local Testing Checklist
Environment Setup
Testing
Exploitation
Tips
Document everything - You'll need it for PoC and reporting
Use test data - Never test with real/sensitive data
Enable verbose logging - Makes tracing easier
Compare with production - Ensure test matches reality
Don't skip to exploitation - Understanding comes first
Last updated