![thumbnail](https://img1.daumcdn.net/thumb/R750x0/?scode=mtistory2&fname=https%3A%2F%2Fblog.kakaocdn.net%2Fdn%2FbAgrGF%2FbtrBJMe25Yf%2Fts5QU0HwnflHyXVOQQmwLk%2Fimg.png)
[suninatas] Game 04
2022. 5. 10. 19:54
Study/Web Hacking
문제: http://suninatas.com/challenge/web04/web04.asp Point를 입력하는 form이 하나 있고 그 아래에 User-Agent를 표시해주고 있다. form의 Plus버튼을 클릭하면 Point의 값이 1씩 증가한다. 계속 누르다보면 "I like the SuNiNaTas" 팝업창이 뜨면서 값이 25에서 더이상 커지지 않는 다는 것을 알 수 있다. 개발자 도구를 열어보니 주석으로 힌트가 숨겨져 있는 것을 발견했다. 일단 point를 50으로 만들어야 Authkey를 획득할 수 있을 것 같다. 하지만 point는 25에서 더 커지지 않았다. SuNiNaTaS가 이에 대한 힌트가 될 것 같다. 아까 위에서 point를 25에서 더 증가시키려고 할 때 팝업창에 SuNiNaTa..
![thumbnail](https://img1.daumcdn.net/thumb/R750x0/?scode=mtistory2&fname=https%3A%2F%2Fblog.kakaocdn.net%2Fdn%2FcUyfwb%2FbtrBGzNIP6j%2FoSgLk119RnCklK4grUkn0K%2Fimg.png)
[suninatas] Game 03
2022. 5. 10. 19:42
Study/Web Hacking
문제: http://suninatas.com/challenge/web03/web03.asp 문제 페이지에 "Write articles in Notice Board!"라는 문자열이 크게 적혀있다. Notice Board에 글작성을 하라는 의미같다. suninatas의 Notice board로 들어가봤는데 글작성 버튼이 존재하지 않았다. 비슷한 Notice랑 게시판도 확인해봤는데 자유게시판에는 글작성을 할 수 있었다. 자유게시판에서 글작성 버튼을 누르고 URL을 확인해보면 게시판 아래에 write로 더 내려간 것을 알 수 있다. 똑같이 Notice에서도 write에 접근했더니 Notice의 글작성 페이지로 들어올 수 있다. 여기서 아무글이나 작성하면 Authkey를 획득할 수 있다.
![thumbnail](https://img1.daumcdn.net/thumb/R750x0/?scode=mtistory2&fname=https%3A%2F%2Fblog.kakaocdn.net%2Fdn%2Fbn51y7%2FbtrBLXfJNzZ%2FspkURfXzIUxo6gu0bsGTZ1%2Fimg.png)
[suninatas] Game 02
2022. 5. 10. 19:27
Study/Web Hacking
문제: http://suninatas.com/challenge/web02/web02.asp ID와 PW를 입력하는 폼이 있다. 개발자 도구를 열어보니 form태그 아래에 힌트가 주석처리 된 것을 볼 수 있었다. id랑 pw가 같아야 한다는 힌트가 있었다. script도 포함되어 있었는데, id랑 pw가 같으면 폼이 submit되지 않는 것을 알 수 있었다. id랑 pw가 같아야 Authkey를 얻을 수 있을 텐데 script 때문에 폼이 submit 되지 않으니 이를 우회하거나 script를 변경해야 할 것 같다. 여기서는 console을 사용해서 form을 submit 시켜보겠다.먼저 ID와 PW에 같은 값을 입력해놓고, console을 열자.그리고 console창에서 직접 form을 submit시키는..
![thumbnail](https://img1.daumcdn.net/thumb/R750x0/?scode=mtistory2&fname=https%3A%2F%2Fblog.kakaocdn.net%2Fdn%2FbtML2n%2FbtrBMFyRbhc%2FqzKbykY5XYX0Gqf3D5hpbK%2Fimg.png)
[suninatas] Game 01
2022. 5. 10. 19:02
Study/Web Hacking
문제: http://suninatas.com/challenge/web01/web01.asp 써니나타스 1번 문제이다. 문제에 접속하면 화면으ㅔ 코드를 보여주고 있다. 처음엔 PHP인줄 알았으나 알고보니 ASP라는 코드였다. ASP는 한 번도 접해본적이 없어 함수를 검색해가면서 풀었다. Replace(str, first, second)는 str에 주어지는 스트링에서 frist를 second로 대치시키는 함수이다. 따라서 Replace(str, "a", "aad")는 str에서 "a" → "aad"로 바꾸게 된다. 마찬가지로 Replace(result, "i", "in")은 "i" → "in"로 바꾼다. Mid(str, pos, length)는 str에서 pos 인덱스에서부터 length의 길이만큼 가져오는..
![thumbnail](https://img1.daumcdn.net/thumb/R750x0/?scode=mtistory2&fname=https%3A%2F%2Fblog.kakaocdn.net%2Fdn%2FdpnLum%2FbtrBCtfN6ad%2FWWpIKqacOHJkwpkVb59p5k%2Fimg.png)
[dreamhack] basic_exploitation_001
2022. 5. 9. 18:53
Study/System Hacking
문제 풀이 제공된 파일: basic_exploitation_001 / basic_exploitation_001.c #include #include #include #include void alarm_handler() { puts("TIME OUT"); exit(-1); } void initialize() { setvbuf(stdin, NULL, _IONBF, 0); setvbuf(stdout, NULL, _IONBF, 0); signal(SIGALRM, alarm_handler); alarm(30); } void read_flag() { system("cat /flag"); } int main(int argc, char *argv[]) { char buf[0x80]; initialize(); gets(b..
![thumbnail](https://img1.daumcdn.net/thumb/R750x0/?scode=mtistory2&fname=https%3A%2F%2Fblog.kakaocdn.net%2Fdn%2Fc72Lao%2FbtrBuyuFAJq%2FckFVhKzil8zPC9Fb5TCcj0%2Fimg.png)
[dreamhack] basic_exploitation_000
2022. 5. 8. 23:44
Study/System Hacking
문제 풀이 제공된 파일: basic_exploitation_000 / basic_exploitation_000.c #include #include #include #include void alarm_handler() { puts("TIME OUT"); exit(-1); } void initialize() { setvbuf(stdin, NULL, _IONBF, 0); setvbuf(stdout, NULL, _IONBF, 0); signal(SIGALRM, alarm_handler); alarm(30); } int main(int argc, char *argv[]) { char buf[0x80]; initialize(); printf("buf = (%p)\n", buf); scanf("%141s", buf)..
![thumbnail](https://img1.daumcdn.net/thumb/R750x0/?scode=mtistory2&fname=https%3A%2F%2Fblog.kakaocdn.net%2Fdn%2Flh5K7%2FbtrBzdCARKN%2Fr6VbsasXb0NIbh0heeIA2k%2Fimg.png)
[dreamhack] Return Address Overwrite
2022. 5. 8. 19:03
Study/System Hacking
문제 풀이 제공된 파일: rao.c // Name: rao.c // Compile: gcc -o rao rao.c -fno-stack-protector -no-pie #include #include void init() { setvbuf(stdin, 0, 2, 0); setvbuf(stdout, 0, 2, 0); } void get_shell() { char *cmd = "/bin/sh"; char *args[] = {cmd, NULL}; execve(cmd, args, NULL); } int main() { char buf[0x28]; init(); printf("Input: "); scanf("%s", buf); return 0; } rao를 컴파일 한 후 디버깅해보자. 스택에 0x30크기의 공간이 ..
![thumbnail](https://img1.daumcdn.net/thumb/R750x0/?scode=mtistory2&fname=https%3A%2F%2Fblog.kakaocdn.net%2Fdn%2FouUvM%2FbtrBsuKD1IK%2FtbtQqM5AcVzAqfIVt7Fw3K%2Fimg.png)
[dreamhack] Exploit Tech: Return Address Overwrite
2022. 5. 6. 19:14
Study/System Hacking
분석 취약점 분석 // Name: rao.c // Compile: gcc -o rao rao.c -fno-stack-protector -no-pie #include #include void init() { setvbuf(stdin, 0, 2, 0); setvbuf(stdout, 0, 2, 0); } void get_shell() { char *cmd = "/bin/sh"; char *args[] = {cmd, NULL}; execve(cmd, args, NULL); } int main() { char buf[0x28]; init(); printf("Input: "); scanf("%s", buf); return 0; } scanf("%s", buf);에 취약점이 존재한다. 입력의 길이에 제한을 두지 않기..
![thumbnail](https://img1.daumcdn.net/thumb/R750x0/?scode=mtistory2&fname=https%3A%2F%2Fblog.kakaocdn.net%2Fdn%2FccjUpj%2FbtrBlL6ZeVc%2FKDCEonJEhxo1DEB7DhRVe1%2Fimg.png)
[dreamhack] Memory Corruption: Stack Buffer Overflow
2022. 5. 5. 17:46
Study/System Hacking
버퍼 오버플로우 버퍼(Buffer) 버퍼는 '데이터가 목적지로 이동되기 전에 보관되는 임시 저장소'이다. 데이터 처리 속도가 다른 두 장치가 있을 때 그 사이에 버퍼를 두면 완충 작용을 할 수 있다. 송신측은 버퍼로 데이터를 전송하고, 수신측은 버퍼에서 데이터를 꺼내어 쓰면 버퍼가 가득 찰 때까지는 유실되는 데이터 없이 통신할 수 있기 때문이다. 현대에는 이런 완충의 의미가 많이 희석되어 데이터가 저장될 수 있는 모든 단위를 버퍼라고 부른다. 스택에 있는 지역 변수는 '스택 버퍼', 힙에 할당된 메모리 영역은 '힙 버퍼'라고 불린다. 버퍼 오버플로우 말 그대로 버퍼가 넘치는 것을 말한다. 10개의 원소를 가진 char배열은 10바이트의 크기를 가진다. 해당 버퍼에 20바이트의 문자를 저장하게 되면 10바..