반응형

 

도대체 왜 안되는 걸까에서 보름을 잡아 먹은 것 같다.

이런 저런 고민 끝에 문제가 해결 됐다.

 

문제는 취약한 파일의 이슈

그리고 전체적인 구조 파악을 하지 못 한 것들....

 

코드를 보고 계속 탐구 한 끝에 File Fuzzer v.0.1을 만들었다.

 

 

 

아직, 수정해야 하는 부분이 남아 있다.

crash가 발생하고 먼저 죽어버리는 상황이 발생 한다.

모니터링 함수 내부에서 종료 하는 함수로 인해서 비정상적으로 종료 되어 해당 내용을 수정 해야 한다.

 

 

그래도 성공 하였으니, 일단 v.0.1 버전으로 올리도록 하겠다.

환경은 Windows 7/Python v.2.7을 사용하였다.

반응형
반응형

 

파이썬 해킹 프로그래밍으로 현재 디버기를 만들고 있는 상황인데

Context 값을 얻어오지 못하는 현상이 발생했다.

과연 무엇 때문에 그럴까????

 

>>>>> 현재 내 환경은 Windows7 64bit 이다.

 

Enter The PID of the process to attach to : 3692
[*] Select PID 3692
[*] OpenProcess Handle : 124
[*] self.h_process : 124
[*] Enumerate Thread inside
[*] Dumping registers for Thread ID: 0x00001928
[*] EIP : 0x00000000
[*] ESP : 0x00000000
[*] EBP : 0x00000000
[*] EAX : 0x00000000
[*] EBX : 0x00000000
[*] ECX : 0x00000000
[*] EDX : 0x00000000
[*] End DUMP

이유는 64bit에서는 32bit 레지스터를 사용하지 않는다.

따라서, RIP, RSP, RBP 등등 확장된 레지스터를 사용하기 때문에 담는 그릇도 틀리다.

32bit에서 실행할 경우 아래와 같이 출력이 가능하다.

 

 

32bit 

 64bit

Enter The PID of the process to attach to : 3364
[*] Select PID 3364
[*] OpenProcess Handle : 1900
[*] self.h_process : 1900
[*] Enumerate Thread inside
[*] Dumping registers for Thread ID: 0x00000d1c
[*] EIP : 0x7c93e514
[*] ESP : 0x0007fde0
[*] EBP : 0x0007fdfc
[*] EAX : 0x00b50088
[*] EBX : 0x00000000
[*] ECX : 0x00001f40
[*] EDX : 0x000adea8
[*] End DUMP
[*] Dumping registers for Thread ID: 0x000001d0
[*] EIP : 0x7c9820ec
[*] ESP : 0x00acfff8
[*] EBP : 0x00000000
[*] EAX : 0x00000000
[*] EBX : 0x00000001
[*] ECX : 0x00000002
[*] EDX : 0x00000003
[*] End DUMP
[*] finished debugging. Exiting...

[*] self.h_process : 124
[*] Enumerate Thread inside
[*] Get Thread Context inside
[##] Thread Handle : 0xac
[*] Dumping registers for Thread ID: 0x00001dc0
[*] RIP : 0x0000000002535318
[*] RSP : 0x000000000021f690
[*] RBP : 0x000000000021f470
[*] RAX : 0x000000000021f6a0
[*] RBX : 0x0000000000001100
[*] RCX : 0x000000000258c0b8
[*] RDX : 0x000000000021f470
[*] End DUMP
[*] Get Thread Context inside
[##] Thread Handle : 0xac
[*] Dumping registers for Thread ID: 0x000003c0
[*] RIP : 0x0000000002535318
[*] RSP : 0x000000000021f690
[*] RBP : 0x000000000021f470
[*] RAX : 0x000000000021f6a0
[*] RBX : 0x0000000000001100
[*] RCX : 0x00000000738e692d
[*] RDX : 0x000000000021f470
[*] End DUMP

 

이런 어처구니 없는 삽질을 할 줄이야...ㅡ.ㅡ;;;

다른 사람은 이런 일이 없길....

 

반응형

'프로그래밍 > Python' 카테고리의 다른 글

Windows 7에서 GetModuleHandle 사용하기  (0) 2013.07.12
64bit debugger 만들기  (0) 2013.07.02
python thread context 보기(win7 64bit)  (2) 2013.07.02
Context 32bit / 64bit 선언  (0) 2013.06.29
GetLastError() - 0x00000032  (0) 2013.06.27
반응형

SyntaxError: Non-ASCII character 의 경우 코드내에 Unicode 형태의 문자열이 있을때 발생한다.

따라서, Unicode형 문자열이 있을 때는 아래와 같이 첫 줄에 추가해 주면 해결이 된다.

 

# -*- coding: euc-kr -*-

 

or

 

UTF-8 : #-*- coding: utf-8 -*-

 

or

 

CP949 : # -*- coding: cp949 -*-

 

참고하길...

반응형
반응형

:출처: http://www.compulogy.org/?tag=0x00000032

ERROR_NOT_SUPPORTED

While running code examples from the awesome “Gray Hat Python” book by Justin Seitz, I kept getting the ERROR_NOT_SUPPORTED (error code 0×00000032) error while trying to attach to a running process using the DebugActiveProcess call in the Microsoft Windows kernel32.dll shared library. Other folks seem to have had the same problem. Fortunately, after some brief reading of the Microsoft’s MSDN pages, the problem turns out to be rather trivial.

According to MSDN page on Win32 error codes, the ERROR_NOT_SUPPORTED code indicates that (what a surprise!) the request is not supported. That is, the call to the DebugActiveProcess method is not supported for the particular application (a python-based debugger in this case).  The MSDN page on kernel and user mode states that “a processor in a computer running Windows has two different modes: user mode and kernel mode. [...]  Applications run in user mode, and core operating system components run in kernel mode.” Finally, on the MSDN page on choosing the 32-Bit or 64-Bit debugging tools, we find that debugging live user-mode code that is running on the same computer as the debugger requires the use of the 64-bit tools for debugging 64-bit code (and 32-bit code running on WOW64).

So the solution to the above problem is simply to install the 64-bit version of the Python interpreter. And don’t forget to set the 64-bit interpreter in the project settings in case you’re using Eclipse following the recommendation in Seitz’s book.

 

##########################################################

결론 :::::  32bit python을 64bit 환경에서 사용하면 안된다~!!!

반응형

+ Recent posts