[random

rand() is never seeded, so it returns the same value every run and the password is a fixed constant.

2026.08.18 Pwn original post

flag 는 권한이 필요하다. 랜덤 코드를 보면 password 를 맞추면 플래그가 나옴.

Figure 1

이 문제는 rand() 함수의 취약점을 이용하는 CTF 문제다 핵심 취약점: random = rand(); // 시드(seed)를 설정하지 않음! srand()로 시드를 설정하지 않으면, rand()는 항상 동일한 값을 반환한다. 기본 시드는 1로 고정된다.

풀이: rand()의 기본 반환값을 알아내고, key XOR random = 0xcafebabe 조건을 만족하는 key를 계산하면 된다.

key = rand() ^ 0xcafebabe

그러니까 걍

python3 -c "print(1804289383 ^ 0xcafebabe)" | ./random

하면

Figure 2