728x90 ๋ฐ์ํ Lucete291 LOB orge -> troll ๋จผ์ ์์ค๋ฅผ ํ์ธํด๋ณด์!์ธ์๋ 2๊ฐ๋ฅผ ๋์์ ์๊ณ argv[1]์ 48์ ๋ํ memset์ผ๋ก ์ด๊ธฐํ๊ฐ ๋๋ค. ๊ทธ๋ผ ์ผ๋จ ์๊ฐ์ ํด๋ณด๋ฉด ๊ธฐ๋ณธ์ ์ผ๋ก ํ์ผ์ด๋ฆ ๋๋ฌธ์ argv[0]์ ๋จน๊ณ ๊ฐ๋ค. ๊ทธ๋ฌ๋ฏ๋ก ์๊ฐ์ ํด์ผํ๋๋ฐ;;; ํ์ผ์ด๋ฆ์ ์ฌ๋ณผ๋ฆญ๋งํฌ๋ฅผ ์ด์ฉํด์ ์์ฝ๋๋ฅผ ๋ฑ๋ก ํ๋ฉด ์ด๋จ๊น? ์ ์๋ 48๋ฐ์ดํธ๋ฅผ ์์ฝ๋๋ฅผ ์ฌ์ฉํ์๋ค. ์ด์ ๋ \x2f ์ฆ / ๊ฐ์์ผ๋ฉด ์ฌ๋ณผ๋ฆญ ๋งํฌ๋ฅผ ๋ง๋ค์ ์๊ธฐ ๋๋ฌธ์ด๋ค. ์ด๋ ๊ฒ ์ฌ๋ณผ๋ฆญ ๋งํฌ๋ฅผ ๊ฑธ๊ณ ๋ํ gdb ๋ฅผ ์ด์ฉํด ๋ค์ด๊ฐ์ ๊ณต๊ฒฉ์ ํ๊ณ ์ฃผ์๊ฐ์ด ๋ค๋ฎ์ธ ๊ฒ์ ํ์ธ ํด๋ณด๊ณ ์ฃผ์๊ฐ์ ์ด์ฉํ์ฌ ๊ณต๊ฒฉ์ ํ๋ค. ๋ฌผ๋ก ์ฌ๋ณผ๋ฆญ ๋งํฌ๋ฅผ ์ด์ฉํ๋ค. ๊ทธ๋ ๊ฒ ๋๋ฉด coreํ์ผ์ด ๋ง๋ค์ด ์ง๋๋ฐ ์ด๋ฅผ ์ด์ฉํ์ฌ ์ง์ง ์ฃผ์๊ฐ์ ๊ตฌํด๋ณผ ๊ป๋ฐ core๋ฅผ gdb ๋ก ํ์ธ ํ๊ณ x/700s $esp๋ฅผ ํ๋ค๋ณด๋ฉด ์ด.. Wargame/CTF(Capture The Flag) 2015. 10. 15. system 24byte shellcode \x31\xc0\x50\x68\x2f\x2f\x73\x68\x68\x2f\x62\x69\x6e\x89\xe3\x50\x53\x89\xe1\x99\xb0\x0b\xcd\x80 Security Study/System 2015. 10. 15. Use After Free use after free ๋ผ๋ ์ทจ์ฝ์ ์ ํ๋ก๊ทธ๋จ ๋ฉ๋ชจ๋ฆฌ๋ ํฌ๊ฒ Code/Data/Heap/Stack์ผ๋ก ๋๋ ์ ์๋๋ฐ Code+Data=Binary์์ญ Heap=ํ๋ก๊ทธ๋๋จธ๊ฐ ๋์ ํ ๋น/ํ์/์ ์ด ํ ์ ์๋ ์์ญ Stack=ํจ์ ๊ฐ๋ณ๊ณต๊ฐ(์คํํ๋ ์),์ธ์์ ๋ฌ๋ฑ์ผ๋ก ์ฌ์ฉํ๋ ์์ญ ์ด๋ ๊ฒ ๊ตฌ๋ถํ ์ ์๋ค ์ด ์ค์์ UAF๋ ํ๋ก๊ทธ๋๋จธ๊ฐ ํ ์์ญ์ ์๋ชป ๋ค๋ค์ ๋ ๋ฐ์ํ๋ ์ทจ์ฝ์ ์ด๋ค. ์๋์ ์์ค๋ฅผ ๋ณด์ #include #include typedef struct UAF{int number;}uaf; int main(void){uaf *one;uaf *two; one = malloc(100);printf("one->number:%d\n",one->number); one->number=12345;printf(.. Security Study/System 2015. 10. 12. pwnable.kr shellshock ๋ณดํธ๋์ด ์๋ ๊ธ ์ ๋๋ค. 2015. 10. 11. memory ์์ญ memory code ์์ญ- ์ฝ๋๋ฅผ ๊ตฌ์ฑํ๋ memory ์์ญ์ผ๋ก hex file or bin fire memory- program ๋ช ๋ น์ด ์์นํ๋ ๊ณณ์ผ๋ก ๊ธฐ๊ณ์ด๋ก ์ ์ด๋๋ ๋ฉ๋ชจ๋ฆฌ ์์ญ์ด๋ค. data ์์ญ- ์ ์ญ๋ณ์, ์ ์ ๋ณ์, ๋ฐฐ์ด, ๊ตฌ์กฐ์ฒด ๋ฑ์ด ์ ์ฅ๋์ด ์๋ค. * ์ด๊ธฐํ ๋ ๋ฐ์ดํฐ๋ data ์์ญ์ ์ ์ฅ๋๊ณ ์ด๊ธฐํ ๋์ง ์์ ๋ฐ์ดํฐ๋ bss(block stated symbol)์ ์ ์ฅ๋๋ค. - ํ๋ก๊ทธ๋จ์ด ์คํ ๋ ๋ ์์ฑ๋์ด ํ๋ก๊ทธ๋จ ์ข ๋ฃ ์ ๊น์ง ์กด์ฌํ๋ค. - ํจ์ ๋ด๋ถ์ ์ ์ธ๋ static ๋ณ์๋ ํ๋ก๊ทธ๋จ์ด ์คํ ๋ ๋ ๊ณต๊ฐ๋ง ํ ๋น๋๊ณ , ํจ์๊ฐ ์คํ ๋ ๋ ์ด๊ธฐํ ๋๋ค. heap ์์ญ- ํ์์ ๋ฐ๋ผ ๋์ ์ผ๋ก ๋ฉ๋ชจ๋ฆฌ๋ฅผ ํ ๋น ํ๊ณ ์ ํ ๋ ์์นํ๋ ๋ฉ๋ชจ๋ฆฌ ์์ญ์ผ๋ก ๋์ ๋ฐ์ดํฐ ์์ญ์ด๋ผ๊ณ ๋ถ๋ฅด๋ฉฐ, ๋ฉ๋ชจ.. Security Study/System 2015. 10. 7. ๋ค๋ค!!! ๋ค๋ค ์ฆ๊ฑฐ์ด ๋ช ์ ๋์๊ณ ์กฐ์ฌํ ๊ณ ํฅ๋ค๋ ์ค์ธ์!!!โ My Story 2015. 9. 25. toolhelp #include #include #include#include#include int _tmain(int argc, _TCHAR* argv[]){ /* */HANDLE hProcess = CreateToolhelp32Snapshot(TH32CS_SNAPPROCESS, 0); PROCESSENTRY32 process;process.dwSize = sizeof(PROCESSENTRY32); _tprintf(_T("%32s %8s %8s %8s\n"), L"[NAME]", L"[PID]", L"[THREAD]", L"[PPID]"); while (Process32Next(hProcess, &process)){_tprintf(_T("%32s %8d %8d %8d\n"),process.szExeFile, // pr.. Language 2015. 9. 24. C์ธ์ด ์ ๋ฆฌ C์ธ์ด์ ์ฅ์ C์ธ์ด๋ ์ ์ฐจ์งํฅ์ ํน์ฑ์ ์ง๋๋ค. ๋๋ฌธ์ ์ต์ํด์ง๋๋ฐ ์ค๋ ์๊ฐ์ด ๊ฑธ๋ฆฌ์ง ์๋๋ค. ์ฆ, ์ ์ฐจ์งํฅ ํ๋ก๊ทธ๋๋ฐ์์ ์ค์ฌ์ด ๋๋ ๊ฒ์ ‘์์’์ด๋ค.C์ธ์ด๋ก ์์ฑ๋ ํ๋ก๊ทธ๋จ์ ์ด์์ฑ์ด ์ข๋ค.C์ธ์ด๋ก ๊ตฌํ๋ ํ๋ก๊ทธ๋จ์ ์ข์ ์ฑ๋ฅ์ ๋ณด์ธ๋ค. C์ธ์ด๋ ๊ธฐ๋ณธ์ ์ผ๋ก ํจ์๋ก ์์ํด์ ํจ์๋ก ๋๋๋ค.int => ์ถ๋ ฅํํ main => ํจ์์ด๋ฆ (void) => ์ ๋ ฅํํ ์์ int์ void๋ ๊ฐ๊ฐ ์ถ๋ ฅ๊ณผ ์ ๋ ฅ์ ํํ๋ฅผ ์ค๋ช ํ๋ ๊ฒ์ด๋ค. ์ฆ, ์ถ๋ ฅ์ ํํ๊ฐ int ์ด๊ณ ์ ๋ ฅ์ ํํ๊ฐ void์ธ main์ด๋ผ๋ ํจ์ C์ธ์ด์ ํจ์ ๋ด์ ์กด์ฌํ๋ ๋ฌธ์ฅ์ ๋์๋ ์ธ๋ฏธ์ฝ๋ก ๋ฌธ์ ;์ ๋ถ์ฌ์ค๋ค. printf ํจ์๋ ํจ์ํธ์ถ ์ ์ ๋ฌ๋๋ ๋ฌธ์์ด์ ๋ชจ๋ํฐ์ ์ถ๋ ฅํ๋ ๊ธฐ๋ฅ์ ์ง๋๋ค. ์ด๋ ์ง์ ๋ง๋ค์ง ์์๋ ํธ์ถ์ด ๊ฐ๋ฅํ, .. Language 2015. 9. 22. C์ธ์ด์ ๋ฉ๋ชจ๋ฆฌ ๊ตฌ์กฐ ใ ฃ ใ ฃใ ฃ ใ ฃใ กใ กใ กใ กใ กใ กใ กใ กใ ฃ ใ ฃใ ฃ ใ ฃ main ํจ์์ฆ, ๋จผ์ ํธ์ถ ๋ ํจ์์ ์คํ๊ณต๊ฐ ์ผ์๋ก ๋ฆ๊ฒ ํด์ฒด ๋๋ค. free ํจ์๋ฅผ ํธํํ์ง ์์ผ๋ฉด ํ๋ก๊ทธ๋จ ์ข ๋ฃ ํ์๋ ๋ฉ๋ชจ๋ฆฌ๊ฐ ๋จ์๊น?-> ํ๋ก๊ทธ๋จ ์คํ์ ํ ๋น๋ ๋ฉ๋ชจ๋ฆฌ ๊ณต๊ฐ์ ํ๋ก๊ทธ๋จ์ด ์ข ๋ฃ๋๋ฉด ์ด์์ฒด์ ์ ์ํด์ ์ ๋ถ ํด์ ๊ฐ ๋๋ค. ์ ํ์ฒ๋ฆฌ๋?์ปดํ์ผ ์ด์ ์ ์ฒ๋ฆฌ๋ฅผ ์๋ฏธํ๋ค. ๋งคํฌ๋ก ํจ์์ ์ฅ์ - ์ผ๋ฐ ํจ์์ ๋นํด ์๋๊ฐ ๋น ๋ฅด๋ค.- ์๋ฃํ์ ๋ฐ๋ผ์ ๋ณ๋๋ก ํจ์๋ฅผ ์ ์ํ์ง ์์๋ ๋๋ค. ๋งคํฌ๋ก ํจ์์ ๋จ์ - ์ ์ํ๊ธฐ๊ฐ ์ ๋ง๋ก ๊น๋ค๋กญ๋ค.- ๋๋ฒ๊น ํ๊ธฐ๊ฐ ์ฝ์ง ์๋ค. Security Study/System 2015. 9. 21. ssl client #include #include #include #include #include #include #include #include #include #include #define FAIL -1 int OpenConnection(const char *hostname, int port){ int sd; struct hostent *host; struct sockaddr_in addr; if ( (host = gethostbyname(hostname)) == NULL ) { perror(hostname); abort(); } sd = socket(PF_INET, SOCK_STREAM, 0); bzero(&addr, sizeof(addr)); addr.sin_family = AF_INET; addr.sin_port.. Security Study/Network 2015. 9. 18. ssl server #include #include #include #include #include #include #include #include #include #include "openssl/ssl.h"#include "openssl/err.h" #define FAIL -1 int OpenListener(int port){ int sd; struct sockaddr_in addr; sd = socket(PF_INET, SOCK_STREAM, 0); bzero(&addr, sizeof(addr)); addr.sin_family = AF_INET; addr.sin_port = htons(port); addr.sin_addr.s_addr = INADDR_ANY; if ( bind(sd, (struct sockaddr*)&a.. Security Study/Network 2015. 9. 18. echo UDP_client #include #include #include #include #include #include #include #define BUFSIZE 30void error_handling(char *message); int main(int argc, char **argv){int sock;char message[BUFSIZE];int str_len, addr_size; struct sockaddr_in serv_addr;struct sockaddr_in from_addr;int clnt_addr_size; if (argc != 3){printf("Usage : %s \n", argv[0]);exit(1);} sock = socket(PF_INET, SOCK_DGRAM, 0); if (sock == -1)erro.. Security Study/Network 2015. 9. 18. ์ด์ 1 ยทยทยท 17 18 19 20 21 22 23 ยทยทยท 25 ๋ค์ 728x90 ๋ฐ์ํ