Repair a web PoC using the real HTTP transaction
Needs: A valid baseline transaction with correct host, base path, session/CSRF state and request encoding
Before changing the script, reproduce the relevant request with Burp or curl and compare
# Before changing the script, reproduce the relevant request with Burp or curl and compare
curl -i -X METHOD 'SCHEME://HOSTNAME:PORT/PATH' \
-H 'Host: HOSTNAME' \
-H 'Cookie: COOKIE' \
--data 'PARAM=VALUE'
# For a scoped lab with a known self-signed certificate
curl -k -i 'https://HOSTNAME:PORT/PATH'
In Python Requests, use a session when cookies or defaults must persist
# In Python Requests, use a session when cookies or defaults must persist
with requests.Session() as session:
response = session.get(url, timeout=10)
print(response.status_code, response.url)
print(response.headers)
print(response.text[:500])
Set
verify=Falseonly for a scoped test after confirming the certificate problem; it disables certificate and hostname validation. Prefer a supplied CA bundle when possible.
Parser cue:
IndexError, missing-key and regular-expression failures mean the received response did not have the assumed shape. Print status, final URL, headers and a bounded body fragment before rewriting the parser. Common causes are a changed path, redirect, failed login, CSRF change, error page, proxy/WAF response or certificate handling.
Verify → Check the target action/output rather than trusting the PoC's success string.
If it fails → A normal HTTP response can be an authentication or parsing failure. Separate application request repair from payload/callback diagnosis. More detail ↓
Explanation & examples
Repair a web PoC using the real HTTP transaction
- USE WHEN
- An exploit sends requests but authentication, routing or parsing differs from the target
- STARTING ACCESS
- An identified component/build and a candidate exploit with reviewable source
- RESULT
- A PoC that reproduces the relevant application request and a separately verified effect
Recognize the clue
Capture the application's real valid transaction and compare it with the PoC's request path, login/session sequence and response parser.
curl -sk -i -b cookies.txt http://TARGET:PORT/PATH
PoC response: HTTP/1.1 302 Found
Location: /login
Actual browser request includes a fresh CSRF tokenMeans: The request never reached the protected operation; the success parser may be reading a login response.
Confirm: Restore valid host/path/session/CSRF state, then independently verify the exploit effect.
- After validation
- The reconstructed request reaches the intended operation and the effect is observed: continue that candidate.
- Ruled out in this context
- The real operation/schema is incompatible with the PoC's vulnerable feature: reject it.
- Still inconclusive
- A normal HTTP response without authenticated operation evidence leaves exploitation inconclusive.
Troubleshooting: A normal HTTP response can be an authentication or parsing failure. Separate application request repair from payload/callback diagnosis.
Before changing the script, reproduce the relevant request with Burp or curl and compare:
For a scoped lab with a known self-signed certificate:
In Python Requests, use a session when cookies or defaults must persist:
Set verify=False only for a scoped test after confirming the certificate problem; it disables certificate and hostname validation. Prefer a supplied CA bundle when possible.
Parser cue:
IndexError, missing-key and regular-expression failures mean the received response did not have the assumed shape. Print status, final URL, headers and a bounded body fragment before rewriting the parser. Common causes are a changed path, redirect, failed login, CSRF change, error page, proxy/WAF response or certificate handling.
Why it works
Web exploit assumptions often fail at login, cookie handling, URL construction or response parsing before the vulnerable behavior is reached. Reconstruct the request before editing payload logic.
Worked example · hypothetical
Observation: the PoC reports success after a redirect to login. Test: compare its request with the authenticated browser baseline. Illustrative output: a missing CSRF token prevented the protected request. Interpretation: repair that state, then independently test the claimed effect.
New identity, privilege, host or route? Re-enumerate → All topic tasks →