← Back to Writeups
CUSTOMEasyReversing

Lrep

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

Lrep

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

Summary

Language: Perl. Source code provided. Program extracts flag characters from a hardcoded string based on XOR condition.

Lrep — Reverse Kids 2.0

Description

Language: Perl. Source code provided. Program extracts flag characters from a hardcoded string based on XOR condition.

Analysis

perl
$text = "2I7VjH)Q3RkPK*Sm3R!aY8!1P:5T6YL-`N4U5M,;xB#v1D%24U";
# For each pair of adjacent chars (a, b) in text:
# if ord(a) == (ord(b) ^ 97), then a must match next char of input

The program iterates through pairs of adjacent characters in $text. If ord(a) == ord(b) ^ 97, then character a must match the next input character. ‍​‌‌​​‌​​​‌‌​​‌​​​​‌‌​‌​​​​‌‌‌​​‌​​‌‌​​​‌​​‌‌‌​​​​​‌‌​‌‌​​​‌‌​​​​‍

Solution

Find all positions where the condition is satisfied and collect the characters:

python
text = "2I7VjH)Q3RkPK*Sm3R!aY8!1P:5T6YL-`N4U5M,;xB#v1D%24U"
flag = ""
for i in range(len(text)-1):
    if ord(text[i]) == (ord(text[i+1]) ^ 97):
        flag += text[i]
# REDACTED

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