
makin - 안티 디버깅 및 안티 VM 트릭 공개 [이 프로젝트는 더 이상 유지보수되지 않습니다]
저는 초기 악성코드 분석을 조금 더 쉽게 하기 위해 makin을 만들었습니다. 다른 사람들에게도 유용할 거라 생각합니다. 이 도구는 샘플이 사용하는 디버거 탐지 기법을 밝혀내는 데 도움을 줍니다.
makin은 샘플을 디버기로 열고 asho.dll을 인젝션합니다(메인 모듈은 인젝션 전에 모든 dll의 이름을 변경합니다). asho.dll은 ntdll.dll 및 kernelbase.dll 라이브러리의 여러 함수를 후킹한 후, 매개변수 검사를 거쳐 해당 메시지를 디버거(makin.exe)에 전송합니다.
makin은 또한 감지된 API에 중단점을 설정하기 위한 IDA Pro 스크립트를 생성합니다.
현재 makin은 다음과 같은 기법을 밝혀낼 수 있습니다:
ntdll.dll:
NtClose - 참조: The "Ultimate" Anti-Debugging Reference: 7.B.iiNtOpenProcess - 참조: The "Ultimate" Anti-Debugging Reference: 7.B.iNtCreateFile - 참조: The "Ultimate" Anti-Debugging Reference: 7.B.iii (자기 자신 열기)NtCreateFile - 참조: The "Ultimate" Anti-Debugging Reference: 7.B.iii (드라이버 열기)LdrLoadDll - 참조: The "Ultimate" Anti-Debugging Reference: 7.B.ivNtSetDebugFilterState - 참조: The "Ultimate" Anti-Debugging Reference: 7.D.viNtQueryInformationProcess - 참조: The "Ultimate" Anti-Debugging Reference: 7.D.viii.a, 7.D.viii.b, 7.D.viii.cNtQuerySystemInformation - 참조: kernelbase.dll:
IsDebuggerPresent - 참조: MSDNCheckRemoteDebuggerPresent - 참조: MSDNSetUnhandledExceptionFilter - 참조: The "Ultimate" Anti-Debugging Reference: D.xvRegOpenKeyExInternalW - 레지스트리 키 확인RegQueryValueExW - 레지스트리 키 값 확인실행 파일을 수정하지 않고 checks.json 파일을 편집하여 더 많은 VM 검사를 추가할 수 있습니다.
지금은 여기까지입니다. 원하는 만큼 얼마든지 추가할 수 있습니다 :)

NtSetInformationThread - 참조: The "Ultimate" Anti-Debugging Reference 7.F.iiiNtCreateUserProcess - 참조: The "Ultimate" Anti-Debugging Reference 7.G.iNtCreateThreadEx - 참조: ntuery 블로그 게시물NtSystemDebugControl - 참조: @waleedassar - pastebinNtYieldExecution - 참조: The "Ultimate" Anti-Debugging Reference 7.D.xiiiNtSetLdtEntries - 참조: ANTI-UNPACKER TRICKS: PART ONE - 2.1.2NtQueryInformationThread - 참조: ntquery - NtQueryInformationThreadNtCreateDebugObject and NtQueryObject - 참조: Anti-Debug NtQueryObjectRtlAdjustPrivilege - 참조: Using RtlAdjustPrivilege to detect debugger by insid3codeteamPEB->BeingDebugged - IsDebuggerPresent()를 호출하는 대신, 일부 프로그램은 PEB(프로세스 환경 블록)에서 BeingDebugged 플래그를 수동으로 확인합니다.PEB->NtGlobalFlag - 참조: al-khaserUserSharedData->KdDebuggerEnabled - 참조: al-khaser - SharedUserData_KernelDebuggerPROCTECTED 핸들 닫기 트릭 - 참조: al-khaser - HANDLE_FLAG_PROTECT_FROM_CLOSE