ABOUT ME

-

Today
-
Yesterday
-
Total
-
  • windbg 명령어 정리
    Pentesting/Windows 2019. 2. 13. 10:00

    1. [windbg] 32-bit or 64-bit 디버깅 변경 명령어

    - !wow64exts.sw


    2. [windbg] 심볼 추가 값

    - SRV*C:\windbgsymbols*http://msdl.microsoft.com/download/symbols

    - .reload


    3. [windbg] 심볼 확인

    - x *!

    - x kernel32!virtual*

    - x *!messagebox*


    4. [windbg] 도움말 보기

    - .hh

    - .hh <command>


    5. [windbg] 사용 중인 모듈 보기

    - lmf

    - lmf m ntdll

    - !dh ntdll                            // 모듈 이미지 헤더 값 출력


    6. [windbg] 여러 포멧으로 값을 출력

    - .formats 1234


    7. [windbg] 연산 필요할 땐 '?' 사용

    - ? eax+4


    8. [windbg] 심볼이 아닌 레지스터로 인식하게 만드려면 '$', '@' 사용

    - $teb / @$teb                                     //teb address

    - $peb / @$peb                                     //peb address

    - $thread / @$thread                         //current thread


    9. [windbg] Breakpoints

    - bp 4110a0

    - bp 4110a0 3    // BP가 3번 발생되지만 1,2번째 BP는 무시하고 3번째만 보기

    - g                 // bp 이후 계속 진행

    - g <code location>         // 특정 주소를 만날 떄까지 실행하기

    - bl                    // breakpoint list

    - bd <breakpoint id>             // breakpoint 비활성화

    - bc <breakpoint id>             // breakpoint 삭제

    - bc *                    // 모든 breakpint 삭제

    - bp 40a410 ".echo \"Here are the registers:\n\"; r" // breakpoint 실행 시 특정 명령어가 자동 실행

    - bp jscript9+c2c47 ".printf \"new Array Data: addr = 0x%p\\n\",eax;g" // breakpoint 실행 시 특정 명령어가 자동 실행

    - ba <mode> <size> <address> <passes (default=1)>            // Hardware Breakpoints


    10. [windbg] Stepping

    - Step-in / trace (t)

    - Step-over (p)

    - Step-out (gu)


    11. [windbg] memory 확인

    - db : bytes(1)

    - dw : words(2)

    - dd : dwords(4)

    - dq : qwords(8)

    - dyb : bit

    - da : null로 끝나는 아스키 문자열 표시

    - du : null로 끝나는 유니코드 문자열 표시

    - d* [range] : 영역 설정

    - db <시작 주소> <끝 주소>

    - dd <시작 주소> L<요소의 수>            // 77cac000부터 10개의 dwords 출력


    12. [windbg] memory 수정

    - e[d|w|b] <address> [<new value 1> ... <new value N>]

    // [d|w|b]는 선택이며 수정 할 요소의 크기를 의미(d=dword, w=word, b=byte)

    // ed eip cc cc    // eip 주소 이후 2개의 dwords에 대해 값을 0xcc로 변경


    13. [windbg] memory 검색

    - s [-d|-w|-b|-a|-u] <start address> L?<number of elements> <search values>

    // d,w,b,a,u는..dword,word,byte,ascii,unicode를 의미. <search value>는 검색 할 값의 순서

    // s -d eip L?1000 cc cc

    // [eip, eip+1000*4-1]위치의 영역에서 0xcc 0xcc의 dowrds 값이 연속적으로 있는 경우 검색


    14. [windbg] 포인터

    - dd poi(ebp+4)         // poi(ebp+4)는 ebp+4 주소에 있는 dword를 역참조


    15. [windbg] 레지스터 보기

    - r

    - r eax, edx


    16. [windbg] 콜 스택 보기

    - k


    17. [windbg] 구조 덤핑

    - !teb    // displays the TEB

    - $teb    // address of the TEB

    - !peb    // displays the PEB

    - $peb    // address of the PEB

    - !exchain    // displays the current exception handler chain

    - !vadump        // displays the list of memory pages and info

    - !lmi <module name>    // displays information for the specified module


    18. [windbg] mona 사용하기

    - .load pykd.pyd

    - !py mona

    - !py mona config -set workingfolder "C:\mona.files\%p_%i"      // 모나 작업 디렉토리 설정

    - !py mona config -set excluded_modules "module1.dll,module2.dll"    //검색 시 특정 모듈 제외

    - !py mona config -add excluded_modules "module3.dll,module4.dll"    // 검색 시 특정 모듈 제외

    - !py mona modules // 모듈 보기


    19. [windbg] 모듈 심볼 정보 확인

    - lm m [module name] // lm m Exploitme2



    -> 추가 업데이트 예정

    댓글

Designed by Tistory.