GithubHelp home page GithubHelp logo

0x13337 / corelantraining Goto Github PK

View Code? Open in Web Editor NEW

This project forked from corelan/corelantraining

0.0 1.0 0.0 510 KB

Script(s) to assist with the setup of WinDBG & mona.py on a Windows 10 VM

PowerShell 100.00%

corelantraining's Introduction

This repository contains script(s) to assist with the setup of Virtual Machines, in preparation for Corelan Windows Exploit Development Training.

For info on classes, see https://www.corelan-training.com/

Usage

  1. Download CorelanVMInstall.ps1 to your Windows 10 VM
  2. Open an administrator command prompt and go to the folder that contains the CorelanVMInstall.ps1 file
  3. Verify/confirm that you have a working internet connection
  4. run powershell ./CorelanVMInstall.ps1
  5. If all goes well, the script will:
  • download installers for Python 2.7.17, WinDBG, PyKD, mona.py, windbglib.py and Visual Studio 2017 Desktop Express
  • install the required prerequisites and applications
  • set up the PATH environment variable
  • create a system environment variable _NT_SYMBOL_PATH

FAQ

File CorelanVMInstall.ps1 cannot be loaded because running scripts is disabled on this system

My freshly installed Windows 10 doesn't allow me to run your powershell script. It produces the following error message:

./CorelanVMInstall.ps1 : File CorelanVMInstall.ps1 cannot be loaded because running scripts is disabled on
 this system. For more information, see about_Execution_Policies at https:/go.microsoft.com/fwlink/?LinkID=135170.

Solution:

  • Open a PowerShell window (as administrator)
  • Run Set-ExecutionPolicy RemoteSigned and press "Y" when prompted
  • Try running the powershell script again.

!peb produces 'error 3 InitTypeRead' on Windows 10 1903/1909

On Windows 10 (1903/1909), WinDBG throws an error when running !peb or when trying to run mona.py commands:

0:000> !peb
PEB at xxxxxxxx
error 3 InitTypeRead

It looks like MS may have removed(?) type information from the latest symbol files associated with ntdll.dll. As a workaround, you can try the following procedure:

  1. Open folder c:\symbols\wntdll.pdb and delete all subfolders
  2. Open an administrator command prompt
  3. Run C:\Program Files (x86)\Windows Kits\10\Debuggers\x86\windbg.exe -o c:\windows\system32\calc.exe
  4. In WinDBG, run !peb and confirm that it is still broken
  5. Close WinDBG and open folder c:\symbols\wntdll.pdb. There should be only one subfolder, for instance D85FCE08D56038E2C69B69F29E11B5EE1(the actual name could be different). Open the folder and remove wntdll.pdb from that folder. We'll call this the original folder. Leave this original D85FCE08D56038E2C69B69F29E11B5EE1 folder open.
  6. Download wntdllsymbolfix.zip file from this repository
  7. Extract the zipfile directly into the c:\symbols\wntdll.pdb folder. You should get an additional folder and a file:
  • Folder: 6BFA8EAE64E07F11AD6B27F575C7BDC21
  • File: ChkMatch.exe
  1. From inside the new 6BFA8EAE64E07F11AD6B27F575C7BDC21 folder, copy wntdll.pdb and paste it into the original folder (the one where you just removed wntdll.pdb)
  2. Open an administrator command prompt and go to the c:\symbols\wntdll.pdb folder
  3. Run the following command to forcibly match ntdll.dll with the older symbol file (replace with the name of the original folder):
ChkMatch.exe -m c:\Windows\SysWOW64\ntdll.dll c:\symbols\wntdll.pdb\<foldername>\wntdll.pdb

Example output:

C:\symbols\wntdll.pdb>ChkMatch.exe -m c:\Windows\SysWOW64\ntdll.dll c:\symbols\wntdll.pdb\D85FCE08D56038E2C69B69F29E11B5EE1\wntdll.pdb
ChkMatch - version 1.0
Copyright (C) 2004 Oleg Starodumov
http://www.debuginfo.com/


Executable: c:\Windows\SysWOW64\ntdll.dll
Debug info file: c:\symbols\wntdll.pdb\D85FCE08D56038E2C69B69F29E11B5EE1\wntdll.pdb

Executable:
TimeDateStamp: a4208572
Debug info: 2 ( CodeView )
TimeStamp: a4208572  Characteristics: 0  MajorVer: 0  MinorVer: 0
Size: 35  RVA: 000255e8  FileOffset: 000249e8
CodeView format: RSDS
Signature: {d85fce08-d560-38e2-c69b-69f29e11b5ee}  Age: 1
PdbFile: wntdll.pdb
Debug info: 13 ( Unknown )
TimeStamp: a4208572  Characteristics: 0  MajorVer: 0  MinorVer: 0
Size: 1252  RVA: 0002560c  FileOffset: 00024a0c
Debug info: 16 ( Unknown )
TimeStamp: a4208572  Characteristics: 0  MajorVer: 0  MinorVer: 0
Size: 36  RVA: 00025af0  FileOffset: 00024ef0

Debug information file:
Format: PDB 7.00
Signature: {6bfa8eae-64e0-7f11-ad6b-27f575c7bdc2}  Age: 2

Writing to the debug information file...
Result: Success.

  1. Open WinDBG again (C:\Program Files (x86)\Windows Kits\10\Debuggers\x86\windbg.exe -o c:\windows\system32\calc.exe), run !peb and verify that the issue has been resolved

Enjoy!

corelantraining's People

Contributors

corelanc0d3r avatar raghavmishra avatar

Watchers

James Cloos avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.