Skip to content

Latest commit

 

History

3 Commits

Folders and files

NameName
Last commit message
Last commit date
 
 
 
 
 
 
 
 
 
 

Repository files navigation

JIT Shellcode Generator

[FR] Documentation

Ce script permet de generer un shellcode formate pour du JIT Spraying. Il convertit une commande Bash en une suite de nombres flottants (double precision).

Fonctionnement

Le script genere des instructions assembleur x64 correspondant a la commande. Chaque instruction est pad a 6 octets, suivie d'un saut court (jmp) de 2 octets. Cela permet de cacher le shellcode dans les constantes immediates des instructions movabs generees par le compilateur JIT.

Calcul du Saut (Jump)

Pour calculer la valeur de l'argument --jump, il faut analyser la memoire JIT.

Comme montre dans la capture d'ecran ci-dessous :

  1. Reperez l'adresse du movabs contenant votre premier bloc (ex: 0xceb90903cec8348).
  2. Reperez l'adresse du movabs suivant (ex: 0xceb909090c03148).
  3. La distance de saut doit permettre d'atterrir exactement, depuis la fin de votre bloc (offset +8), au debut du bloc suivant (offset +2 dans le movabs suivant).

Formule : Jump = (Adresse Movabs Suivant) - (Adresse Movabs Actuel) - 8

Capture d'écran 2026-01-10 025941

Usage

python jit2shellcode.py "commande" --jump <DISTANCE>

[EN] Documentation

This script generates formatted shellcode for JIT Spraying. It converts a Bash command into a sequence of double-precision floating-point numbers.

How it works

The script generates x64 assembly instructions for the command. Each instruction is padded to 6 bytes, followed by a 2-byte short jump. This hides the shellcode within the immediate constants of movabs instructions generated by the JIT compiler.

Jump Calculation

To calculate the --jump argument, you must analyze the JIT memory.

As shown in the screenshot below: Capture d'écran 2026-01-10 025941

  1. Locate the address of the movabs containing your first block (e.g., 0xceb90903cec8348).
  2. Locate the address of the next movabs (e.g., 0xceb909090c03148).
  3. The jump distance must land exactly from the end of your block (offset +8) to the start of the next block (offset +2 in the next movabs).

Formula: Jump = (Next Movabs Address) - (Current Movabs Address) - 8

Usage

python jit2shellcode.py "command" --jump <DISTANCE>

Poc

image

About

This script generates formatted shellcode for JIT Spraying. It converts a Bash command into a sequence of double-precision floating-point numbers.

Resources

Stars

1 star

Watchers

0 watching

Forks

Releases

Packages

Contributors

Languages