← Back to Writeups
CUSTOMEasyReversing

Rust

XESXOR9/10/20261 min read
#reversing#custom#easy#linear_arithmetic_reverse#source_code_analysis

Rust

Platform: rev-kids20.forkbomb.ru | Category: Reversing | Type: Challenge | Difficulty: Easy | OS: NA | Author: XESXOR | Date: 2026-03-09 | Status: Solved Techniques: linear_arithmetic_reverse, source_code_analysis

Summary

Language: Rust. Source code provided. Flag checker with linear transformation.

Rust — Reverse Kids 2.0

Description

Language: Rust. Source code provided. Flag checker with linear transformation.

Analysis

rust
let check:Vec<u32> = vec![215, 233, 200, 218, 374, 167, 164, 158, ...];
for i in checked.as_bytes() {
    if ((*i as u32) * 3 + 5) != check[counter] {
        println!("Nope");
        return;
    }
}

Each input byte is multiplied by 3 and 5 is added, then the result is compared with the check array.

Solution

Inverse formula: byte = (check[i] - 5) / 3 ‍​‌‌​​​​‌​‌‌​​‌‌​​‌‌​​‌‌​​‌‌​​‌​​​​‌‌​​​​​‌‌​​‌‌​​‌‌​​‌​‌​‌‌​​‌​‌‍

python
check = [215, 233, 200, 218, 374, 167, 164, 158, 167, 311, 308, 296, 158, 164, 155, 167, 170, 173, 173, 167, 161, 158, 155, 152, 158, 164, 311, 311, 308, 380]
flag = ''.join(chr((v - 5) // 3) for v in check)
# FLAG{REDACTED}

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