• Stars
    star
    159
  • Rank 234,577 (Top 5 %)
  • Language
    Python
  • Created almost 6 years ago
  • Updated 8 months ago

Reviews

There are no reviews yet. Be the first to send feedback to the community and the maintainers!

Repository Details

basic amd64 alphanumeric shellcode encoder

AE64

AE64 is a tool which can transform any amd64 architecture shellcode into pure alphanumeric shellcode using self-modify code technology, so the page need to be writable.

Install

git clone https://github.com/veritas501/ae64.git --depth 1
cd ae64
sudo python3 setup.py install

Usage

For usage example, you can see example folder.

Quickstart

from ae64 import AE64
from pwn import *
context.arch='amd64'

# get bytes format shellcode
shellcode = asm(shellcraft.sh())

# get alphanumeric shellcode
enc_shellcode = AE64().encode(shellcode)
print(enc_shellcode.decode('latin-1'))

About default

enc_shellcode = AE64().encode(shellcode)
# equal to 
enc_shellcode = AE64().encode(shellcode, 'rax', 0, 'fast')

'''
def encode(self, shellcode: bytes, register: str = 'rax', offset: int = 0, strategy: str = 'fast') -> bytes:
"""
encode given shellcode into alphanumeric shellcode (amd64 only)
@param shellcode: bytes format shellcode
@param register: the register contains shellcode pointer (can with offset) (default=rax)
@param offset: the offset (default=0)
@param strategy: encode strategy, can be "fast" or "small" (default=fast)
@return: encoded shellcode
"""
'''

About encode strategy

I write two encode strategy, fast and small.

Fast strategy is the default strategy, it generate alphanumeric shellcode very fast, but the shellcode is a bit long.

Small strategy generate shellcode with the help of z3-solver, so it will be slower but when encoding big shellcode, it can gernerate much smaller shellcode.

Benchmark

Functionality:

ae64 alpha3
Encode x32 alphanumeric shellcode
Encode x64 alphanumeric shellcode
Original shellcode can contain zero bytes
Base address register can contain offset

Length:

Origin length(in bytes) ae64(fast) ae64(small) alpha3
2 76 119 65
48 237 185 157
192 749 401 445
576 2074 977 1213

P.S.

length 2 shellcode: "lbl : jmp lbl"

length 48 shellcode: shellcraft.sh()

length 192 shellcode: shellcraft.sh()*4

length 576 shellcode: shellcraft.sh()*12

Old story

For older version which I written for HCTF2018 christmas pwn challenge, goto branch old_archive.

https://github.com/veritas501/ae64/tree/old_archive

ver1 details: https://github.com/veritas501/hctf2018#pwn---christmas4-solves

More Repositories

1

CVE-2022-34918

CVE-2022-34918 netfilter nf_tables 本地提权 POC
C
215
star
2

Potplayer-Subtitle-Translate-GoogleFix

Fix bug(restriction) in potplayer subtitle google translate
AngelScript
121
star
3

pipe-primitive

An exploit primitive in linux kernel inspired by DirtyPipe
87
star
4

PltResolver

A plugin to resolve .plt.sec symbols in IDA
Python
76
star
5

ToyObfuscator

Toy LLVM obfuscator pass
C++
69
star
6

pwnpatch

ctf patching toy
Python
44
star
7

Osu-Ingame-Downloader

Just a simple Osu! ingame downloader
C
36
star
8

CVE-2021-22555-PipeVersion

CVE-2021-22555 exploit rewritten with pipe primitive
C
36
star
9

multiarch-rootfs-env

multiarch qemu system env for playing and debugging :)
Shell
29
star
10

cross_page_attack_demo

linux kernel cross page attack demo module
C
28
star
11

iidada

Merge multi binaries into one IDA database.
Python
24
star
12

hbp_attack_demo

linux kernel LPE using hw_breakpoint attack tech demo
C
24
star
13

ip_derper

build tailscale derper server without domain
Dockerfile
20
star
14

dl_dbgsym

Python
19
star
15

CVE-2022-25636-PipeVersion

CVE-2022-25636 exploit rewritten with pipe primitive
C
19
star
16

tiny_elf_sample

C
16
star
17

CVE-2022-0185-PipeVersion

CVE-2022-0185 exploit rewritten with pipe primitive
C
16
star
18

glibc_got_hijack_study

study https://github.com/n132/Libc-GOT-Hijacking
Python
11
star
19

CVE-2022-3910

CVE-2022-3910
C
11
star
20

CVE-2023-0386

C
10
star
21

core2elf64

Do same thing like https://github.com/enbarberis/core2ELF64 but in python3 (WIP)
Python
10
star
22

CVE-2022-2588

CVE-2022-2588
C
10
star
23

my-ctf-xinetd

fast deploy pwn , using docker & ctf_xinted
Python
8
star
24

Qiniu-markdown-pic-uploader

快速上传剪贴板中的图片到七牛云并粘贴出相印图片地址的markdown形式
C#
8
star
25

hctf_wp

hctf 2017 my writeup
C++
8
star
26

gdb-with-fzf

replace gdb default history searcher with fzf fuzzy finder
C
8
star
27

hctf2018

hctf2018 part (the_end,heapstorm_zero,christmas,eazy_dump)
Python
7
star
28

CVE-2021-4154

CVE-2021-4154
C
6
star
29

win-port-proxy

Go
5
star
30

CHIP-8_Emulator

CHIP-8模拟器
C++
4
star
31

deflat-study

Python
3
star
32

my_minifmod

my_minifmod
C
3
star
33

go-elevate-demo

Go
3
star
34

pwndbg_ida_xmlrpc

plugin format https://github.com/pwndbg/pwndbg/blob/dev/ida_script.py
Python
3
star
35

veritas501.github.io

veritas501's blog
2
star
36

something_about_82es

something_about_82es
2
star
37

spc_player

spc_player
C++
1
star
38

attachment_in_blog

attachment_in_blog
1
star
39

veritas501

1
star
40

Keysound-Maker-Plus

Yet another keysound maker for making beatmap hitsound
C#
1
star
41

Obsidian-Veritas-Theme

My private Obsidian theme
CSS
1
star