Eval Injection
Overview
Code Injection Fundamentals
What is Code Injection?
Injection Type
What's Affected
Key Points
Dangerous Functions by Language
Code Injection Functions (Highlighted)
JavaScript (Node.js)
Python
PHP
Command Injection Functions
JavaScript
Python
PHP
C/C++
C#
Java
Eval Injection Basics
Functions That Evaluate Strings as Code
Basic Vulnerable Example
Exploitation
Analyzing validateString
How It's Called
The eval Call
Condition Analysis
Role
onError Value
User Input?
Key Insight
String Interpolation in JavaScript
Backtick Strings (Template Literals)
Vulnerability
Testing the Vulnerability
Setup
Get Token
Send Payload
Modify Role in Debugger
Response
What the Payload Does
Payload: ";// `
";// `Character
Purpose
Resulting eval String
The Filter Problem
validateString Checks
Challenge
Wait, What?
Next Steps
Key Takeaways
Last updated