GoogleCTF#beginners/re-gatekeeper

문제

풀어 보았다.
첨부파일을 다운로드하고 압축을 풉니다.

어떤 파일을 모르기 때문에 BZ에서 보았을 때 ELF 파일이었습니다.
Linux 실행 파일입니다. Windows에서 말하는 exe 같은 이미지.

bintext에서 플래그가 없는지 살펴 보겠습니다.

flag 안에는 변수가 들어가는 것 같아서 대답은 몰랐습니다.
직전에 이상한 문자열이 있었기 때문에 감으로 해 보았습니다만, 어느쪽도 달랐습니다.
첨부파일을 다운로드하고 압축을 풉니다.

어떤 파일을 모르기 때문에 BZ에서 보았을 때 ELF 파일이었습니다.
Linux 실행 파일입니다. Windows에서 말하는 exe 같은 이미지.

bintext에서 플래그가 없는지 살펴 보겠습니다.

flag 안에는 변수가 들어가는 것 같아서 대답은 몰랐습니다.
직전에 이상한 문자열이 있었기 때문에 감으로 해 보았습니다만, 어느쪽도 달랐습니다.
IDA를 사용하여 흐름을 살펴보겠습니다.

왠지 정답하면 flag가 나올 것 같습니다.
어셈블리를 읽는 것은 뼈가 부러지기 때문에 Ubuntu에서 움직입니다.

인수에 유저명과 패스워드를 입력해 주는 에러로 아무것도 하지 않고 종료했습니다.
유저명과 패스워드는 모릅니다만, 아까의 캐릭터 라인이 괴롭기 때문에 해 봅니다.

좋지 않았습니다. 사용자 이름과 비밀번호를 반대로 시도합니다.

좋지 않았습니다.
하지만 잘 읽지 않았기 때문에 조금 깨닫지 못했습니다.
Incorrect username
라는 문자가 있다는 것을 깨달았습니다.
처음에는 비밀번호가 다르다는 오류로 이번에는 사용자 이름이 다르다는 오류입니다.
라고 하는 것은 1회째는 유저명은 있었다고 하는 것이 될 것 같습니다.
다시 IDA를 살펴 보겠습니다.

단순히 문자열을 비교하고 있는 것 같기 때문에, 있다고 생각합니다만. . .
라고 생각하면 그 앞의 오른쪽으로 가는 처리가 조금 신경이 쓰입니다.
오른쪽으로 가면 다시 돌아올 것 같습니다.
혹시 입력한 문자열을 편집하고 있을지도 모릅니다.
하지만 어셈블러를 읽을 수 없습니다.
조사한 곳
리눅스 ltrace 명령을 사용하면 함수 호출을 볼 수 있습니다.
이제 strcmp를 보면 좋지 않을까요?
해보자.

대량의 데이터가 넘쳐 와서 이것은 힘들다.
파일로 출력합니다.

그리고 test.txt 안에서 strcmp를 봅니다.

암호의 첫 번째 인수의 문자가 뒤집혀 있습니다.
조금 전의 IDA를 보는 한 첫 번째 인수는 아마 입력의 문자열 쪽이라고 생각합니다만, 일단 확인해 보겠습니다.

이것을 실행하고 test.txt의 strcmp를 다시보십시오.

하야 입력한 문자열이 뒤집히는 것 같습니다.
아까의 수수께끼의 처리에서 뒤집어 놓고 있겠지요.
그래서 뒤집은 문자열을 인수로 다시 실행해 보겠습니다.

했습니다.

Reference
이 문제에 관하여(GoogleCTF#beginners/re-gatekeeper), 우리는 이곳에서 더 많은 자료를 발견하고 링크를 클릭하여 보았다 https://qiita.com/samohan/items/390c6a97f239d5fae491텍스트를 자유롭게 공유하거나 복사할 수 있습니다.하지만 이 문서의 URL은 참조 URL로 남겨 두십시오.
우수한 개발자 콘텐츠 발견에 전념
(Collection and Share based on the CC Protocol.)