exploit the possibilities

D-Link DGS-1250 Header Injection

D-Link DGS-1250 Header Injection
Posted Feb 21, 2020
Authored by Harry Sintonen

D-Link DGS-1250 suffers from a header injection vulnerability that can be leveraged through cross site scripting.

tags | exploit, xss
SHA-256 | 7d7d9f8705c8fb7f26571e187596182c238f6573faea1c552faf5d97d4edd1f2

D-Link DGS-1250 Header Injection

Change Mirror Download
D-Link DGS-1250 header injection vulnerability
==============================================
The latest version of this advisory is available at:
https://sintonen.fi/advisories/d-link-dgs-1250-header-injection.txt


Overview
--------

D-Link DGS-1250 switch is susceptible to a header injection vulnerability enabling
attacker to steal the switch configuration.


Description
-----------

D-Link DGS-1250 switch web user interface fails to sanitize certain form parameters
for malicious input. The attacker is able to inject arbitrary headers to the HTTP
response, bypassing browser Cross-Origin protection.


Impact
------

Malicious external JavaScript can exfiltrate the D-Link DGS-1250 switch configuration.
The configuration includes admin credentials with plain text passwords among other
confidential information.


Details
-------

The discovered vulnerability, described in more detail below, enables the attack
described here in brief.

1. The attacker creates a malicious JavaScript payload. The payload will have code
to exploit the vulnerability to exfiltrate the switch configuration (*):

var xhr = new XMLHttpRequest();
xhr.open("POST", location.protocol + "//10.90.90.90/BinFile/config.cfg", false);
xhr.withCredentials = true;
xhr.send("hidunit_id=1&hidfile_type=2&hidoption_type=0&hidsrc_file=Config1&" +
"hidfile_name=config.txt%0a" +
"Access-Control-Allow-Credentials: true%0a" +
"Access-Control-Allow-Origin: " + window.location.origin);
if (xhr.status === 200) {
// send xhr.responseText to the attacker
}

2. The attacker adds the JavaScript payload to web site(s) and lures the logged in
administrator to visit the site, either by mass spamming or by targeted
phishing.

3. As soon as the logged in administrator visits the malicious site with the
JavaScript payload, the full switch configuration is sent to the attacker.


*) The example payload uses a fixed default IP address. Real world attack could be
smarter in this regard: it could attempt to determine the client's internal IP
address by leveraging WebRTC. Once the client IP address is identified the attack
would attempt to fetch an image URL from the web user interface. Successful image
loading would indicate that the switch is found.


Vulnerabilities
---------------

1. CWE-113: Improper Neutralization of CRLF Sequences in HTTP Headers

`/BinFile/config.cfg' fails to neutralize CRLF sequences in `hidfile_name' parameter.
Thus it is possible to include additional headers to the HTTP response, such as CORS
(Cross-Origin Resource Sharing) headers "Access-Control-Allow-Credentials" and
"Access-Control-Allow-Origin". Successful injection enables a third-party web site
to receive the POST response (config file).


Proof-of-Concept
----------------

For devices without SSL configured:
http://sintonen.fi/advisories/d-link-dgs-1250-header-injection-poc.html

For devices with SSL configured:
https://sintonen.fi/advisories/d-link-dgs-1250-header-injection-poc.html

The PoC expects the switch to use the default IP address 10.90.90.90.


Vulnerable versions
-------------------

The following D-Link DGS-1250 firmware versions are known to be vulnerable:
- Build 1.00.040
- Build 2.01.006

Older versions are likely vulnerable as well, but were not tested. Other D-Link
models could be affected as well.


Impact of the SameSite cookie attribute
---------------------------------------

Browsers that implement SafeSite cookie attribute and default it to "Lax" mode
will automatically mitigate this vulnerability. At least Chrome and Firefox are
likely to switch to defaulting to Lax mode sometime in 2020.


Vendor recommendations
----------------------

1. Sanitize input that ends up in the HTTP response headers. In particular do not
allow linefeed characters (ASCII characters 10 and 13) as-is.


End user mitigation
-------------------

1. Use a dedicated browser session to access the web user interface.


Credits
-------

The vulnerability was discovered by Harry Sintonen / F-Secure Consulting.


Timeline
--------

2019.12.18 initial discovery of the vulnerability
2019.12.18 reported the vulnerability to D-Link via Report Vulnerabilities form
2019.12.19 received vendor acknowledgement
2020.01.08 requested status update from the vendor contact
2020.01.10 added section about impact of the SameSite cookie attribute
2020.02.11 sent a reminder to the vendor contact of the default 60 day dislosure
policy
2020.02.19 public disclosure


Login or Register to add favorites

File Archive:

May 2022

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

Top Authors In Last 30 Days

File Tags

Systems

packet storm

© 2022 Packet Storm. All rights reserved.

Services
Security Services
Hosting By
Rokasec
close