Skip to content

Instantly share code, notes, and snippets.

### Keybase proof
I hereby claim:
* I am jthuraisamy on github.
* I am jthuraisamy (https://keybase.io/jthuraisamy) on keybase.
* I have a public key whose fingerprint is 3CC0 1B4C 2920 F44E 8973 2DFD 764F 2E48 2337 A611
To claim this, I am signing this object:
@jthuraisamy
jthuraisamy / scf.py
Last active April 9, 2018 19:43
SMB/HTTP Auth Capture via SCF
#!/usr/bin/env python3
# -*- coding: utf-8 -*-
# References:
# 1. https://pentestlab.blog/2017/12/13/smb-share-scf-file-attacks/
# 2. https://room362.com/post/2016/smb-http-auth-capture-via-scf/
from argparse import ArgumentParser
from configparser import RawConfigParser
@jthuraisamy
jthuraisamy / README.md
Last active September 25, 2019 10:18
CVE-2017-11907 WPAD.dat Generator for Responder

Usage

This script generates a payload for use with Responder.

  1. Generate a payload with main.py
  2. Copy and paste the one-liner output into the WPADScript field of Responder.conf.
test@test:~$ python3 main.py --help
usage: main.py [-h] [-o OUT] cmd

TL;DR: Using symbolic execution to recover driver IOCTL codes that are computed at runtime.

The goal here is to find valid IOCTL codes for the HackSysExtremeVulnerableDriver by analyzing the binary. The control flow varies between the binary and source due to compiler optimizations. This results in a situation where only a few IOCTL codes in the assembly are represented as a constant with the remaining being computed at runtime.

The code in hevd_ioctl.py is a approximation of the control flow of the compiled IrpDeviceIoCtlHandler function. The effects of the compiler optimization are more pronounced when comparing this code to the original C function. To comply with requirements of the PyExZ3 module, the target function is named after the script's filename, and the `ex

@jthuraisamy
jthuraisamy / highlight_calls.py
Created April 4, 2018 01:39
IDAPython Script to highlight function calls.
"""
IDAPython Script to highlight function calls.
Re-implemented by jthuraisamy (not the original author).
Install to %IDADIR%\plugins\highlight_calls.py.
Run by pressing Ctrl+Alt+H or go to Options -> Highlight Call Instructions.
"""
class HighlightHandler(idaapi.action_handler_t):
@jthuraisamy
jthuraisamy / windows-toolkit.md
Last active April 12, 2022 20:00
Windows Toolkit

Windows Toolkit

Binary

Native Binaries

IDA Plugins Preferred Neutral Unreviewed
@jthuraisamy
jthuraisamy / _README.md
Last active October 11, 2024 15:48
GospelRoom: Data Storage in UEFI NVRAM Variables

GospelRoom: Data Storage in UEFI NVRAM Variables

Behaviour

Persist data in UEFI NVRAM variables.

Benefits

  1. Stealthy way to store secrets and other data in UEFI.
  2. Will survive a reimaging of the operating system.
@jthuraisamy
jthuraisamy / syscall.asm
Last active November 23, 2019 18:33
System Call Detection at Runtime (NtCreateFile example)
.code
NtCreateFile PROC
mov rax, gs:[60h]
NtCreateFile_Check_X_X_XXXX: ; Check major version.
cmp dword ptr [rax+118h], 5
je NtCreateFile_SystemCall_5_X_XXXX
cmp dword ptr [rax+118h], 6
je NtCreateFile_Check_6_X_XXXX
cmp dword ptr [rax+118h], 10
@jthuraisamy
jthuraisamy / syscalls.asm
Last active November 24, 2019 22:18
AV/EDR Evasion with Direct System Calls (x64)
This file has been truncated, but you can view the full file.
.code
NtAcceptConnectPort PROC
mov rax, gs:[60h] ; Load PEB into RAX.
NtAcceptConnectPort_Check_X_X_XXXX: ; Check major version.
cmp dword ptr [rax+118h], 5
je NtAcceptConnectPort_SystemCall_5_X_XXXX
cmp dword ptr [rax+118h], 6
je NtAcceptConnectPort_Check_6_X_XXXX
cmp dword ptr [rax+118h], 10
import os.path
import pefile
print('#pragma once')
target_dll = r'target.dll'
pe = pefile.PE(target_dll)
for export in pe.DIRECTORY_ENTRY_EXPORT.symbols:
if export.name:
name = export.name.decode()