Pwnablekr_Toddlers Bottle_shellshock

Shellshock 취약점을 이용하는 문제이다. Shellshock 란 bash 취약점으로, CVE-2014-6271이다. 취약점을 이용하면 환경변수를 통해 bash에 임의의 코드를 실행시킬 수 있다.
#include <stdio.h>
int main(){
setresuid(getegid(), getegid(), getegid());
setresgid(getegid(), getegid(), getegid());
system("/home/shellshock/bash -c 'echo shock_me'");
return 0;
}환경변수에 Shellshock 취약점을 트리거하는 페이로드를 등록한다. 이후 bash를 실행하면 페이로드가 실행된다.

flag는 only if I knew CVE-2014-6271 ten years ago..!! 이다.
tags: writeup, pwnable, elf file, linux, c lang, shellshock, arbitrary code execution