본문 바로가기

보안과정40

Level 3 → Level 4 www.hackerschool.org 를 이용해 공부한다. 목적 : system() 함수의 취약점 level3 사용자로 로그인ID : level3Pass : can you fly? $ ls -l$ cat hint - 동시에 여러 명령어를 사용하려면 ? - 세미콜론- 문자열 형태로 명령어를 전달하려면? - 작은따옴표나 큰따옴표로 묶으면 된다. 소스코드를 통해 알 수 있는 내용Ex) dig @ 168.126.63.1 version.bind chaos txt [참고][클릭] dig/host/nslookup 명령어 사용법 $ find / -name autodig 2>/dev/null$ ls -l /bin/autodig# find / -user level4 -perm -4000 2>/dev/null $ /bin/.. 2017. 11. 28.
dig/host/nslookup 사용 시스템 : Centos 5.5 (final) Name Service Look up CMDⓐ nslookup CMD -> # nslookup www.daum.netⓑ host CMD -> # host www.daum.netⓒ dig CMD -> # dig www.daum.net NAME dig - DNS lookup utility SYNOPSIS dig [@server] [-b address] [-c class] [-f filename] [-k filename] [-m] [-p port#] [-t type] [-x addr] [-y name:key] [-4] [-6] [name] [type] [class] [queryopt...] dig [-h] dig [global-queryopt...] [quer.. 2017. 11. 28.
Level 2 → Level 3 www.hackerschool.org 를 바탕으로 공부한다. level2 사용자로 로그인ID : level2Pass : hacker or cracker $ ls -l$ cat hint $ find / -user level3 -perm -4000 2>/dev/null $ ls -l /usr/bin/editor$ which vi$ ls -l /bin/vi$ ls -l /usr/bin/vim $ /usr/bin/editor:! bash$ my-pass $ exit:q! ○ 리버싱을 통한 의사코드 복원$ gdb /usr/bin/editor(gdb) disas main 123456789#include #include #include int main(){ setreuid(3003, 3003); system("/bi.. 2017. 11. 28.
setreuid 명령어 NAME setreuid, setregid - set real and/or effective user or group ID SYNOPSIS #include #include int setreuid(uid_t ruid, uid_t euid); int setregid(gid_t rgid, gid_t egid); UID(User Identification, Real UID) / EUID(Effective UID)GID(Group Identification, Real GID) / EGID(Effective GID) Real UID : # who am i ( 내가 어떤 사용자로 로그인 했는가 )Effective UID : # id or # whoami ( 현재 내가 누구 인가 ) Setuid는 Effective U.. 2017. 11. 28.