SlideShare a Scribd company logo
1 of 6
Download to read offline
Exploit IE Using Scriptable ActiveX Controls
Yuki Chen (aka guhe120)
1. Background
Several months ago, I tried to write a poc exploit for Internet Explorer 11 with one of our
vulnerabilities. One of the goals was to make this poc exploit bypass microsoft’s EMET tool. As
you may know, there is a feature called EAF (Export Address Filtering) in EMET, which tries to
detect suspicious shellcode behavior by monitoring the access to certain system modules’ export
tables. While this feature is not so hard to bypass, we still need to rewrite our old shellcode to
overcome it. Since I’m too lazy to do the shellcode refracting job, I began to think about one
question: Is it possible to achieve the exploit and the payload behaviors without using any
shellcode?
So below are our assumptions and rules:
1. First, we have a vulnerability to achieve memory leak or corruption (it would be better if it
can be converted to arbitrary memory read/write).
2. Using of any kind of shellcode is not allowed.
3. Using of ROP、VirtualProtect、NtContinue is not allowed.
4. It can bypass all features in the latest version of EMET.
5. It should work for different IE versions (not only IE 11).
And our solution is: Use the browser supported scripts (JavaScript or VBScript) instead of
shellcode to achieve the payload behaviors.
2. Browser Scripts and ActiveX Controls
I selected Javascript as our target script language. As you may know, we can use javascript to call
some ActiveX (COM) controls, for example, the following javascript code will launch a calculator:
var WshShell = new ActiveXObject("WScript.shell");
oExec = WshShell.Exec('calc.exe')
However, if you embed the above script in a html and open it with IE, you won’t success because
of the security settings of Internet Explorer (You may get a warning dialogue or just fail directly
based on your security setting):
:
Then our task is clear: After we achieved memory read/write with our vulnerability, we need to
find a way to bypass the security settings for using ActiveX controls. Is it possible? My answer is
YES.
3. The Safe Mode Flags
After some reversing & debugging in IE, we found that there is a flag in jscript9.dll (or jscript.dll
for IE8) which is used to control the security setting. In all IE versions which we’ve tested on (IE8、
10 and 11),if the condition “flag & 0xB == 0” is met, we will be able to call the unsafe ActiveX
controls using javascript code, without any alert!
Below are some places where the flag exits:
In jscript (5.8.7601.17866),it’s in COleScript+0x188
And in jscript9 (11.0.9600.16518),it becomes ScriptEngine+0x1F0:
What we need to do it to set this flag to 0, then our browser will run in god mode.
Take IE11 (jscirpt9.dll: 11.0.9600.16518) as an example,by leaking certain objects and their data,
we are able to get the address of ScriptEngine:
var func_addr = this.leakAddress(ActiveXObject);
var script_engine_addr = this.read32(this.read32(func_addr + 0x1c) + 4);
4. Seriously, I should try VBScript first
For IE versions before IE11, we just need to simply set the flag to 0 and we win. But in IE11,
Microsoft has added extra checks on this flag. When the flag is set by internal code, a hash “h1” is
computed based on the value of the flag, the address of certain objects and some random data
(And the functions EncoderPointer/DecodePointer are also used to make it harder to
predicate/crack the hash value). After that, when the flag need to be used in some security check,
another hash “h2” will be computed using the same algorithm. And if “h2” is not equal to “h1”
(In condition that we directly modify the value of the flag), the check will fail and IE will exit.
However we are still able to bypass this check in IE11, you can refer to my demo code to find out
how we do it.
Later when we take a look into the vbscript, we are surprised that vbscript.dll in IE11 does not
contain the same check on the flag! So if we choose VBScript at the very beginning, we can save a
lot of efforts. What the **** !
Another solution is that you can force IE to load “jscript.dll” other than “jscript9.dll”.
6.The Demo Code
You can find our demo code here:
https://github.com/guhe120/explib2
It’s import that before you start to try the demo code, you should make sure that you
environment is OK. We developed the demo code on Windows 8.1 32bits and IE 11 32bits, the
following dll versions may be importatnt for the demo to success:
Javascript9.dll (11.0.9600.16521)
msado15.dll (6.3.9600.16384)
If you use other versions, you might get a crash and you will need to fix some offsets according to
your version.
To test the demo code:
1. Copy the folder “explib2” to your web server directory.
2. Open IE and visit the page: explib2/example.html
3. Attach windbg,execute the following command, which is used to simulate the condition of a
javascript array with corrupted length (In our poc exploit, we achieved this by using our
vulnerability)
ed 1a1b3018 400
.detach
Click the dialogue box to continue
4. Here is our debug information to notify us that we have dropped an exe file in the temp
folder using javascript(which is usually achieved by shellcode)
5. Finally our old friend pops up:
Note that since IE11 runs in Low Integrity Level by default in Windows 8.1, we are only able to
create low integrity child process.

More Related Content

What's hot

Serial Killer - Silently Pwning your Java Endpoints // OWASP BeNeLux Day 2016
Serial Killer - Silently Pwning your Java Endpoints // OWASP BeNeLux Day 2016Serial Killer - Silently Pwning your Java Endpoints // OWASP BeNeLux Day 2016
Serial Killer - Silently Pwning your Java Endpoints // OWASP BeNeLux Day 2016
Christian Schneider
 
Fixing the Java Serialization Mess
Fixing the Java Serialization Mess Fixing the Java Serialization Mess
Fixing the Java Serialization Mess
Salesforce Engineering
 
Surviving the Java Deserialization Apocalypse // OWASP AppSecEU 2016
Surviving the Java Deserialization Apocalypse // OWASP AppSecEU 2016Surviving the Java Deserialization Apocalypse // OWASP AppSecEU 2016
Surviving the Java Deserialization Apocalypse // OWASP AppSecEU 2016
Christian Schneider
 
Building a java tracer
Building a java tracerBuilding a java tracer
Building a java tracer
rahulrevo
 

What's hot (20)

Serial Killer - Silently Pwning your Java Endpoints // OWASP BeNeLux Day 2016
Serial Killer - Silently Pwning your Java Endpoints // OWASP BeNeLux Day 2016Serial Killer - Silently Pwning your Java Endpoints // OWASP BeNeLux Day 2016
Serial Killer - Silently Pwning your Java Endpoints // OWASP BeNeLux Day 2016
 
Fixing the Java Serialization Mess
Fixing the Java Serialization Mess Fixing the Java Serialization Mess
Fixing the Java Serialization Mess
 
Surviving the Java Deserialization Apocalypse // OWASP AppSecEU 2016
Surviving the Java Deserialization Apocalypse // OWASP AppSecEU 2016Surviving the Java Deserialization Apocalypse // OWASP AppSecEU 2016
Surviving the Java Deserialization Apocalypse // OWASP AppSecEU 2016
 
Building a java tracer
Building a java tracerBuilding a java tracer
Building a java tracer
 
Java Deserialization Vulnerabilities - The Forgotten Bug Class (DeepSec Edition)
Java Deserialization Vulnerabilities - The Forgotten Bug Class (DeepSec Edition)Java Deserialization Vulnerabilities - The Forgotten Bug Class (DeepSec Edition)
Java Deserialization Vulnerabilities - The Forgotten Bug Class (DeepSec Edition)
 
A topology of memory leaks on the JVM
A topology of memory leaks on the JVMA topology of memory leaks on the JVM
A topology of memory leaks on the JVM
 
Defending against Java Deserialization Vulnerabilities
 Defending against Java Deserialization Vulnerabilities Defending against Java Deserialization Vulnerabilities
Defending against Java Deserialization Vulnerabilities
 
Byte code field report
Byte code field reportByte code field report
Byte code field report
 
Object Oriented Exploitation: New techniques in Windows mitigation bypass
Object Oriented Exploitation: New techniques in Windows mitigation bypassObject Oriented Exploitation: New techniques in Windows mitigation bypass
Object Oriented Exploitation: New techniques in Windows mitigation bypass
 
The old is new, again. CVE-2011-2461 is back!
The old is new, again. CVE-2011-2461 is back!The old is new, again. CVE-2011-2461 is back!
The old is new, again. CVE-2011-2461 is back!
 
Java 10, Java 11 and beyond
Java 10, Java 11 and beyondJava 10, Java 11 and beyond
Java 10, Java 11 and beyond
 
The definitive guide to java agents
The definitive guide to java agentsThe definitive guide to java agents
The definitive guide to java agents
 
Java Deserialization Vulnerabilities - The Forgotten Bug Class (RuhrSec Edition)
Java Deserialization Vulnerabilities - The Forgotten Bug Class (RuhrSec Edition)Java Deserialization Vulnerabilities - The Forgotten Bug Class (RuhrSec Edition)
Java Deserialization Vulnerabilities - The Forgotten Bug Class (RuhrSec Edition)
 
Celery
CeleryCelery
Celery
 
Analysis of bugs in Orchard CMS
Analysis of bugs in Orchard CMSAnalysis of bugs in Orchard CMS
Analysis of bugs in Orchard CMS
 
Why Windows 8 drivers are buggy
Why Windows 8 drivers are buggyWhy Windows 8 drivers are buggy
Why Windows 8 drivers are buggy
 
Monitoring distributed (micro-)services
Monitoring distributed (micro-)servicesMonitoring distributed (micro-)services
Monitoring distributed (micro-)services
 
Abusing Java Remote Interfaces
Abusing Java Remote InterfacesAbusing Java Remote Interfaces
Abusing Java Remote Interfaces
 
Java concurrency in practice
Java concurrency in practiceJava concurrency in practice
Java concurrency in practice
 
Java Concurrency by Example
Java Concurrency by ExampleJava Concurrency by Example
Java Concurrency by Example
 

Similar to Exploit ie using scriptable active x controls version English

Similar to Exploit ie using scriptable active x controls version English (20)

C# Security Testing and Debugging
C# Security Testing and DebuggingC# Security Testing and Debugging
C# Security Testing and Debugging
 
New and improved hacking oracle from web apps sumit sidharth
New and improved hacking oracle from web apps   sumit sidharthNew and improved hacking oracle from web apps   sumit sidharth
New and improved hacking oracle from web apps sumit sidharth
 
6 ways to hack your JavaScript application by Viktor Turskyi
6 ways to hack your JavaScript application by Viktor Turskyi   6 ways to hack your JavaScript application by Viktor Turskyi
6 ways to hack your JavaScript application by Viktor Turskyi
 
CVE 2012-1889 Microsoft XML core services uninitialized memory vulnerability
CVE 2012-1889 Microsoft XML core services uninitialized memory vulnerabilityCVE 2012-1889 Microsoft XML core services uninitialized memory vulnerability
CVE 2012-1889 Microsoft XML core services uninitialized memory vulnerability
 
JS Fest 2019. Виктор Турский. 6 способов взломать твое JavaScript приложение
JS Fest 2019. Виктор Турский. 6 способов взломать твое JavaScript приложениеJS Fest 2019. Виктор Турский. 6 способов взломать твое JavaScript приложение
JS Fest 2019. Виктор Турский. 6 способов взломать твое JavaScript приложение
 
Reverse engineering - Shellcodes techniques
Reverse engineering - Shellcodes techniquesReverse engineering - Shellcodes techniques
Reverse engineering - Shellcodes techniques
 
Discussing Errors in Unity3D's Open-Source Components
Discussing Errors in Unity3D's Open-Source ComponentsDiscussing Errors in Unity3D's Open-Source Components
Discussing Errors in Unity3D's Open-Source Components
 
JavaScript: DOM and jQuery
JavaScript: DOM and jQueryJavaScript: DOM and jQuery
JavaScript: DOM and jQuery
 
PVS-Studio vs Chromium. 3-rd Check
PVS-Studio vs Chromium. 3-rd CheckPVS-Studio vs Chromium. 3-rd Check
PVS-Studio vs Chromium. 3-rd Check
 
We continue checking Microsoft projects: analysis of PowerShell
We continue checking Microsoft projects: analysis of PowerShellWe continue checking Microsoft projects: analysis of PowerShell
We continue checking Microsoft projects: analysis of PowerShell
 
Rootkit case
Rootkit caseRootkit case
Rootkit case
 
How to set up es lint for react projects
How to set up es lint for react projectsHow to set up es lint for react projects
How to set up es lint for react projects
 
How to bypass email gateways using common payloads... Bsides Manchester 2017
How to bypass email gateways using common payloads... Bsides Manchester 2017How to bypass email gateways using common payloads... Bsides Manchester 2017
How to bypass email gateways using common payloads... Bsides Manchester 2017
 
Weblogic 12c Graphical Mode installation steps in Windows
Weblogic 12c Graphical Mode installation steps in Windows Weblogic 12c Graphical Mode installation steps in Windows
Weblogic 12c Graphical Mode installation steps in Windows
 
12c weblogic installation steps for Windows
12c weblogic installation steps for Windows12c weblogic installation steps for Windows
12c weblogic installation steps for Windows
 
Nodejs Intro Part One
Nodejs Intro Part OneNodejs Intro Part One
Nodejs Intro Part One
 
How to reverse engineer Android applications
How to reverse engineer Android applicationsHow to reverse engineer Android applications
How to reverse engineer Android applications
 
How to reverse engineer Android applications—using a popular word game as an ...
How to reverse engineer Android applications—using a popular word game as an ...How to reverse engineer Android applications—using a popular word game as an ...
How to reverse engineer Android applications—using a popular word game as an ...
 
Siebel Open UI Debugging (Siebel Open UI Training, Part 7)
Siebel Open UI Debugging (Siebel Open UI Training, Part 7)Siebel Open UI Debugging (Siebel Open UI Training, Part 7)
Siebel Open UI Debugging (Siebel Open UI Training, Part 7)
 
XPages Blast - ILUG 2010
XPages Blast - ILUG 2010XPages Blast - ILUG 2010
XPages Blast - ILUG 2010
 

Recently uploaded

Why Teams call analytics are critical to your entire business
Why Teams call analytics are critical to your entire businessWhy Teams call analytics are critical to your entire business
Why Teams call analytics are critical to your entire business
panagenda
 
Cloud Frontiers: A Deep Dive into Serverless Spatial Data and FME
Cloud Frontiers:  A Deep Dive into Serverless Spatial Data and FMECloud Frontiers:  A Deep Dive into Serverless Spatial Data and FME
Cloud Frontiers: A Deep Dive into Serverless Spatial Data and FME
Safe Software
 
Architecting Cloud Native Applications
Architecting Cloud Native ApplicationsArchitecting Cloud Native Applications
Architecting Cloud Native Applications
WSO2
 

Recently uploaded (20)

Biography Of Angeliki Cooney | Senior Vice President Life Sciences | Albany, ...
Biography Of Angeliki Cooney | Senior Vice President Life Sciences | Albany, ...Biography Of Angeliki Cooney | Senior Vice President Life Sciences | Albany, ...
Biography Of Angeliki Cooney | Senior Vice President Life Sciences | Albany, ...
 
Apidays New York 2024 - Passkeys: Developing APIs to enable passwordless auth...
Apidays New York 2024 - Passkeys: Developing APIs to enable passwordless auth...Apidays New York 2024 - Passkeys: Developing APIs to enable passwordless auth...
Apidays New York 2024 - Passkeys: Developing APIs to enable passwordless auth...
 
AXA XL - Insurer Innovation Award Americas 2024
AXA XL - Insurer Innovation Award Americas 2024AXA XL - Insurer Innovation Award Americas 2024
AXA XL - Insurer Innovation Award Americas 2024
 
Apidays New York 2024 - The Good, the Bad and the Governed by David O'Neill, ...
Apidays New York 2024 - The Good, the Bad and the Governed by David O'Neill, ...Apidays New York 2024 - The Good, the Bad and the Governed by David O'Neill, ...
Apidays New York 2024 - The Good, the Bad and the Governed by David O'Neill, ...
 
Apidays New York 2024 - Scaling API-first by Ian Reasor and Radu Cotescu, Adobe
Apidays New York 2024 - Scaling API-first by Ian Reasor and Radu Cotescu, AdobeApidays New York 2024 - Scaling API-first by Ian Reasor and Radu Cotescu, Adobe
Apidays New York 2024 - Scaling API-first by Ian Reasor and Radu Cotescu, Adobe
 
ICT role in 21st century education and its challenges
ICT role in 21st century education and its challengesICT role in 21st century education and its challenges
ICT role in 21st century education and its challenges
 
Exploring Multimodal Embeddings with Milvus
Exploring Multimodal Embeddings with MilvusExploring Multimodal Embeddings with Milvus
Exploring Multimodal Embeddings with Milvus
 
Navigating the Deluge_ Dubai Floods and the Resilience of Dubai International...
Navigating the Deluge_ Dubai Floods and the Resilience of Dubai International...Navigating the Deluge_ Dubai Floods and the Resilience of Dubai International...
Navigating the Deluge_ Dubai Floods and the Resilience of Dubai International...
 
Web Form Automation for Bonterra Impact Management (fka Social Solutions Apri...
Web Form Automation for Bonterra Impact Management (fka Social Solutions Apri...Web Form Automation for Bonterra Impact Management (fka Social Solutions Apri...
Web Form Automation for Bonterra Impact Management (fka Social Solutions Apri...
 
Polkadot JAM Slides - Token2049 - By Dr. Gavin Wood
Polkadot JAM Slides - Token2049 - By Dr. Gavin WoodPolkadot JAM Slides - Token2049 - By Dr. Gavin Wood
Polkadot JAM Slides - Token2049 - By Dr. Gavin Wood
 
ProductAnonymous-April2024-WinProductDiscovery-MelissaKlemke
ProductAnonymous-April2024-WinProductDiscovery-MelissaKlemkeProductAnonymous-April2024-WinProductDiscovery-MelissaKlemke
ProductAnonymous-April2024-WinProductDiscovery-MelissaKlemke
 
Exploring the Future Potential of AI-Enabled Smartphone Processors
Exploring the Future Potential of AI-Enabled Smartphone ProcessorsExploring the Future Potential of AI-Enabled Smartphone Processors
Exploring the Future Potential of AI-Enabled Smartphone Processors
 
Why Teams call analytics are critical to your entire business
Why Teams call analytics are critical to your entire businessWhy Teams call analytics are critical to your entire business
Why Teams call analytics are critical to your entire business
 
2024: Domino Containers - The Next Step. News from the Domino Container commu...
2024: Domino Containers - The Next Step. News from the Domino Container commu...2024: Domino Containers - The Next Step. News from the Domino Container commu...
2024: Domino Containers - The Next Step. News from the Domino Container commu...
 
Axa Assurance Maroc - Insurer Innovation Award 2024
Axa Assurance Maroc - Insurer Innovation Award 2024Axa Assurance Maroc - Insurer Innovation Award 2024
Axa Assurance Maroc - Insurer Innovation Award 2024
 
Cloud Frontiers: A Deep Dive into Serverless Spatial Data and FME
Cloud Frontiers:  A Deep Dive into Serverless Spatial Data and FMECloud Frontiers:  A Deep Dive into Serverless Spatial Data and FME
Cloud Frontiers: A Deep Dive into Serverless Spatial Data and FME
 
Apidays New York 2024 - APIs in 2030: The Risk of Technological Sleepwalk by ...
Apidays New York 2024 - APIs in 2030: The Risk of Technological Sleepwalk by ...Apidays New York 2024 - APIs in 2030: The Risk of Technological Sleepwalk by ...
Apidays New York 2024 - APIs in 2030: The Risk of Technological Sleepwalk by ...
 
Architecting Cloud Native Applications
Architecting Cloud Native ApplicationsArchitecting Cloud Native Applications
Architecting Cloud Native Applications
 
Repurposing LNG terminals for Hydrogen Ammonia: Feasibility and Cost Saving
Repurposing LNG terminals for Hydrogen Ammonia: Feasibility and Cost SavingRepurposing LNG terminals for Hydrogen Ammonia: Feasibility and Cost Saving
Repurposing LNG terminals for Hydrogen Ammonia: Feasibility and Cost Saving
 
Strategies for Landing an Oracle DBA Job as a Fresher
Strategies for Landing an Oracle DBA Job as a FresherStrategies for Landing an Oracle DBA Job as a Fresher
Strategies for Landing an Oracle DBA Job as a Fresher
 

Exploit ie using scriptable active x controls version English

  • 1. Exploit IE Using Scriptable ActiveX Controls Yuki Chen (aka guhe120) 1. Background Several months ago, I tried to write a poc exploit for Internet Explorer 11 with one of our vulnerabilities. One of the goals was to make this poc exploit bypass microsoft’s EMET tool. As you may know, there is a feature called EAF (Export Address Filtering) in EMET, which tries to detect suspicious shellcode behavior by monitoring the access to certain system modules’ export tables. While this feature is not so hard to bypass, we still need to rewrite our old shellcode to overcome it. Since I’m too lazy to do the shellcode refracting job, I began to think about one question: Is it possible to achieve the exploit and the payload behaviors without using any shellcode? So below are our assumptions and rules: 1. First, we have a vulnerability to achieve memory leak or corruption (it would be better if it can be converted to arbitrary memory read/write). 2. Using of any kind of shellcode is not allowed. 3. Using of ROP、VirtualProtect、NtContinue is not allowed. 4. It can bypass all features in the latest version of EMET. 5. It should work for different IE versions (not only IE 11). And our solution is: Use the browser supported scripts (JavaScript or VBScript) instead of shellcode to achieve the payload behaviors. 2. Browser Scripts and ActiveX Controls I selected Javascript as our target script language. As you may know, we can use javascript to call some ActiveX (COM) controls, for example, the following javascript code will launch a calculator: var WshShell = new ActiveXObject("WScript.shell"); oExec = WshShell.Exec('calc.exe')
  • 2. However, if you embed the above script in a html and open it with IE, you won’t success because of the security settings of Internet Explorer (You may get a warning dialogue or just fail directly based on your security setting): : Then our task is clear: After we achieved memory read/write with our vulnerability, we need to find a way to bypass the security settings for using ActiveX controls. Is it possible? My answer is YES. 3. The Safe Mode Flags After some reversing & debugging in IE, we found that there is a flag in jscript9.dll (or jscript.dll for IE8) which is used to control the security setting. In all IE versions which we’ve tested on (IE8、 10 and 11),if the condition “flag & 0xB == 0” is met, we will be able to call the unsafe ActiveX controls using javascript code, without any alert! Below are some places where the flag exits: In jscript (5.8.7601.17866),it’s in COleScript+0x188
  • 3. And in jscript9 (11.0.9600.16518),it becomes ScriptEngine+0x1F0: What we need to do it to set this flag to 0, then our browser will run in god mode. Take IE11 (jscirpt9.dll: 11.0.9600.16518) as an example,by leaking certain objects and their data, we are able to get the address of ScriptEngine: var func_addr = this.leakAddress(ActiveXObject); var script_engine_addr = this.read32(this.read32(func_addr + 0x1c) + 4);
  • 4. 4. Seriously, I should try VBScript first For IE versions before IE11, we just need to simply set the flag to 0 and we win. But in IE11, Microsoft has added extra checks on this flag. When the flag is set by internal code, a hash “h1” is computed based on the value of the flag, the address of certain objects and some random data (And the functions EncoderPointer/DecodePointer are also used to make it harder to predicate/crack the hash value). After that, when the flag need to be used in some security check, another hash “h2” will be computed using the same algorithm. And if “h2” is not equal to “h1” (In condition that we directly modify the value of the flag), the check will fail and IE will exit. However we are still able to bypass this check in IE11, you can refer to my demo code to find out how we do it. Later when we take a look into the vbscript, we are surprised that vbscript.dll in IE11 does not contain the same check on the flag! So if we choose VBScript at the very beginning, we can save a lot of efforts. What the **** ! Another solution is that you can force IE to load “jscript.dll” other than “jscript9.dll”. 6.The Demo Code You can find our demo code here: https://github.com/guhe120/explib2 It’s import that before you start to try the demo code, you should make sure that you environment is OK. We developed the demo code on Windows 8.1 32bits and IE 11 32bits, the following dll versions may be importatnt for the demo to success: Javascript9.dll (11.0.9600.16521) msado15.dll (6.3.9600.16384) If you use other versions, you might get a crash and you will need to fix some offsets according to your version. To test the demo code: 1. Copy the folder “explib2” to your web server directory. 2. Open IE and visit the page: explib2/example.html
  • 5. 3. Attach windbg,execute the following command, which is used to simulate the condition of a javascript array with corrupted length (In our poc exploit, we achieved this by using our vulnerability) ed 1a1b3018 400 .detach Click the dialogue box to continue 4. Here is our debug information to notify us that we have dropped an exe file in the temp folder using javascript(which is usually achieved by shellcode) 5. Finally our old friend pops up:
  • 6. Note that since IE11 runs in Low Integrity Level by default in Windows 8.1, we are only able to create low integrity child process.