HTTP Response Injection
Overview
Possible Responses in /generate/
Status
Message
Condition
Understanding the Catch Block
try {
// ...SNIP...
} catch (e) {
if (e.statusCode === 403) {
return next(e); // β Shows 'e.message'
} else {
return next({
message: "Could not generate QR code.",
statusCode: 500, // β Static message
});
}
}Key Insight
Controlling the Response
Test Payload
Result
Injecting Command Output
Original onError String
After Injection
Adding Command Execution
Payload Structure
Full Payload
Final eval String
Testing the Payload
Why Backticks?
Problem
Solution
Practical Exploitation
Step 1: Get Admin Token
Step 2: Find the Flag
Step 3: Read the Flag
Payload Template
Generic Form
With Base64 (for complex commands)
Why Base64?
Problems Without Encoding
Issue
Example
Solution
Comparison: Methods
Method
Pros
Cons
Updated Checklist
#
Step
Status
Key Takeaways
Last updated