Injection III: Cheating the System

Published by bangyen in

The bookstore from this collection has increased their security again. After setting the variable res, an if statement checks if res is equal to the users dictionary. If it is, it sends an error. Create a query that copies users to res.

Examples

param = "your text here"

users = {
  "user1": "password",
  "user2": "password"
}

res = eval("search("%s")" % param)

if res == users:
  res = {"Error": "No products found."}

print(res) ➞ users

Notes

  • Create a string, not a function.
  • For readability, try to break your string into smaller substrings.
  • As an anti-cheat measure, naming a variable x_x is prohibited.
Watch a quick demo on how Edabit works.