HTTP/2 Single Packet Attack low level library based on Scapy
Project description
H2SpaceX
HTTP/2 low level library based on Scapy which can be used for Single Packet Attack (Race Condition on H2)
Dive into Single Packet Attack Article
I wrote an article and published it at InfoSec Write-ups:
TODO
- Single Packet Attack - POST
- implement
- Single Packet Attack - GET
- Content-Length: 1 Method
- POST Request with x-override-method: GET header
- Response Parsing
- implement
- implement threaded response parser
- Body Decompression
- gzip
- br
- deflate
- Proxy
- Socks5 Proxy
More Research
Some following statements are just ideas and not tested or implemented.
- More Request in a Single Packet
- Increase MSS (Idea by James Kettle)
- Out of Order TCP Packets (Idea by James Kettle)
- IP Fragmentation
- Proxy the Single Packet Request through SOCKS
- Single Packet Attack on GET Requests
- Content-Length: 1 Method (Idea by James Kettle)
- x-override-method: GET Method (Idea by James Kettle)
- Index HPACK Headers to Make GET Requests Smaller
- HEADERS Frame without END_HEADER Flag
- HEADERS Frame Without Some Pseudo Headers
Installation
H2SpaceX works with Python 3 (preferred: >=3.10)
pip install h2spacex
Error in Installation
if you get errors of scapy:
pip install --upgrade scapy
Quick Start
You can import the HTTP/2 TLS Connection and set up the connection. After setting up the connection, you can do other things:
from h2spacex import H2OnTlsConnection
h2_conn = H2OnTlsConnection(
hostname='http2.github.io',
port_number=443
)
h2_conn.setup_connection()
...
see more examples in Wiki Page
Examples
See examples which contain some Portswigger race condition examples.
Improved Single Packet Attack Method (Black Hat 2024)
James Kettle introduced a improved version of Single Packet Attack in Black Hat 2024:
You can implement this method easily using send_ping_frame()
method.
Improved Version of SPA Sample Exploit
Reference of Improved Method:
References & Resources
I also got some ideas from a previous developed library h2tinker.
Finally, thanks again to James Kettle for directly helping and pointing some other techniques.
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
File details
Details for the file h2spacex-1.0.1.tar.gz
.
File metadata
- Download URL: h2spacex-1.0.1.tar.gz
- Upload date:
- Size: 24.4 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/4.0.2 CPython/3.10.10
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | 5eb62df7f613047475624f17df92dca2e8141309268a45621739e7bb04238143 |
|
MD5 | 46308a06b0b0cce59f5d226d6175c0b5 |
|
BLAKE2b-256 | 24ef4ce2c0f34fd1c3155591cbb2516d32298cea5eaf8f77e1f349c3f4b88642 |
File details
Details for the file h2spacex-1.0.1-py3-none-any.whl
.
File metadata
- Download URL: h2spacex-1.0.1-py3-none-any.whl
- Upload date:
- Size: 23.5 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/4.0.2 CPython/3.10.10
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | 1f5ef42d2df191835c1b1d0d19a641d7a8c70118e9834f3cafc550da0e509b18 |
|
MD5 | e21ecec30cc0017146e9e3adfbe5e008 |
|
BLAKE2b-256 | 5d569e2f12874df22bc6edb8393c39e5b30992d9fed3c4e1bcd9e98e0dac1cd4 |