Vulnerabilities > CVE-2017-0154 - Injection vulnerability in Microsoft Internet Explorer 11

047910
CVSS 5.8 - MEDIUM
Attack vector
NETWORK
Attack complexity
MEDIUM
Privileges required
NONE
Confidentiality impact
PARTIAL
Integrity impact
PARTIAL
Availability impact
NONE
network
microsoft
CWE-74
nessus

Summary

Microsoft Internet Explorer 11 on Windows 10, 1511, and 1606 and Windows Server 2016 does not enforce cross-domain policies, allowing attackers to access information from one domain and inject it into another via a crafted application, aka, "Internet Explorer Elevation of Privilege Vulnerability."

Common Attack Pattern Enumeration and Classification (CAPEC)

  • Buffer Overflow via Environment Variables
    This attack pattern involves causing a buffer overflow through manipulation of environment variables. Once the attacker finds that they can modify an environment variable, they may try to overflow associated buffers. This attack leverages implicit trust often placed in environment variables.
  • Server Side Include (SSI) Injection
    An attacker can use Server Side Include (SSI) Injection to send code to a web application that then gets executed by the web server. Doing so enables the attacker to achieve similar results to Cross Site Scripting, viz., arbitrary code execution and information disclosure, albeit on a more limited scale, since the SSI directives are nowhere near as powerful as a full-fledged scripting language. Nonetheless, the attacker can conveniently gain access to sensitive files, such as password files, and execute shell commands.
  • Cross Site Scripting through Log Files
    An attacker may leverage a system weakness where logs are susceptible to log injection to insert scripts into the system's logs. If these logs are later viewed by an administrator through a thin administrative interface and the log data is not properly HTML encoded before being written to the page, the attackers' scripts stored in the log will be executed in the administrative interface with potentially serious consequences. This attack pattern is really a combination of two other attack patterns: log injection and stored cross site scripting.
  • Command Line Execution through SQL Injection
    An attacker uses standard SQL injection methods to inject data into the command line for execution. This could be done directly through misuse of directives such as MSSQL_xp_cmdshell or indirectly through injection of data into the database that would be interpreted as shell commands. Sometime later, an unscrupulous backend application (or could be part of the functionality of the same application) fetches the injected data stored in the database and uses this data as command line arguments without performing proper validation. The malicious data escapes that data plane by spawning new commands to be executed on the host.
  • Subverting Environment Variable Values
    The attacker directly or indirectly modifies environment variables used by or controlling the target software. The attacker's goal is to cause the target software to deviate from its expected operation in a manner that benefits the attacker.

Msbulletin

bulletin_idMS17-006
bulletin_url
date2017-03-14T00:00:00
impactRemote Code Execution
knowledgebase_id4013073
knowledgebase_url
severityCritical
titleCumulative Security Update for Internet Explorer

Nessus

NASL familyWindows : Microsoft Bulletins
NASL idSMB_NT_MS17-006.NASL
descriptionThe version of Internet Explorer installed on the remote Windows host is missing Cumulative Security Update 4013073. It is, therefore, affected by multiple vulnerabilities, the most severe of which are remote code execution vulnerabilities. An unauthenticated, remote attacker can exploit these vulnerabilities by convincing a user to visit a specially crafted website, resulting in the execution of arbitrary code in the context of the current user.
last seen2020-06-01
modified2020-06-02
plugin id97729
published2017-03-14
reporterThis script is Copyright (C) 2017-2019 and is owned by Tenable, Inc. or an Affiliate thereof.
sourcehttps://www.tenable.com/plugins/nessus/97729
titleMS17-006: Cumulative Security Update for Internet Explorer (4013073)
code
#
# (C) Tenable Network Security, Inc.
#

include("compat.inc");

if (description)
{
  script_id(97729);
  script_version("1.14");
  script_cvs_date("Date: 2019/11/13");

  script_cve_id(
    "CVE-2017-0008",
    "CVE-2017-0009",
    "CVE-2017-0012",
    "CVE-2017-0018",
    "CVE-2017-0033",
    "CVE-2017-0037",
    "CVE-2017-0040",
    "CVE-2017-0049",
    "CVE-2017-0059",
    "CVE-2017-0130",
    "CVE-2017-0149",
    "CVE-2017-0154"
  );
  script_bugtraq_id(
    96073,
    96077,
    96085,
    96086,
    96087,
    96088,
    96094,
    96095,
    96645,
    96647,
    96724,
    96766
  );
  script_xref(name:"MSFT", value:"MS17-006");
  script_xref(name:"MSKB", value:"3218362");
  script_xref(name:"MSKB", value:"4012204");
  script_xref(name:"MSKB", value:"4012215");
  script_xref(name:"MSKB", value:"4012216");
  script_xref(name:"MSKB", value:"4012217");
  script_xref(name:"MSKB", value:"4012606");
  script_xref(name:"MSKB", value:"4013198");
  script_xref(name:"MSKB", value:"4013429");

  script_name(english:"MS17-006: Cumulative Security Update for Internet Explorer (4013073)");
  script_summary(english:"Checks the version of mshtml.dll or the installed rollup.");

  script_set_attribute(attribute:"synopsis", value:
"The remote host has a web browser installed that is affected by
multiple vulnerabilities.");
  script_set_attribute(attribute:"description", value:
"The version of Internet Explorer installed on the remote Windows host
is missing Cumulative Security Update 4013073. It is, therefore,
affected by multiple vulnerabilities, the most severe of which are
remote code execution vulnerabilities. An unauthenticated, remote
attacker can exploit these vulnerabilities by convincing a user to
visit a specially crafted website, resulting in the execution of
arbitrary code in the context of the current user.");
  script_set_attribute(attribute:"see_also", value:"https://docs.microsoft.com/en-us/security-updates/SecurityBulletins/2017/ms17-006");
  script_set_attribute(attribute:"solution", value:
"Microsoft has released a set of patches for Internet Explorer 9, 10,
and 11.

Note that security update 3218362 in MS17-006 must also be installed
in order to fully resolve CVE-2017-0008 on Windows Vista and Windows
Server 2008.");
  script_set_cvss_base_vector("CVSS2#AV:N/AC:H/Au:N/C:C/I:C/A:C");
  script_set_cvss_temporal_vector("CVSS2#E:H/RL:OF/RC:C");
  script_set_cvss3_base_vector("CVSS:3.0/AV:N/AC:H/PR:N/UI:R/S:U/C:H/I:H/A:H");
  script_set_cvss3_temporal_vector("CVSS:3.0/E:H/RL:O/RC:C");
  script_set_attribute(attribute:"cvss_score_source", value:"CVE-2017-0149");

  script_set_attribute(attribute:"exploitability_ease", value:"Exploits are available");
  script_set_attribute(attribute:"exploit_available", value:"true");
  script_set_attribute(attribute:"exploited_by_malware", value:"true");

  script_set_attribute(attribute:"vuln_publication_date", value:"2017/02/23");
  script_set_attribute(attribute:"patch_publication_date", value:"2017/03/14");
  script_set_attribute(attribute:"plugin_publication_date", value:"2017/03/14");

  script_set_attribute(attribute:"plugin_type", value:"local");
  script_set_attribute(attribute:"cpe", value:"cpe:/o:microsoft:windows");
  script_set_attribute(attribute:"cpe", value:"cpe:/a:microsoft:ie");
  script_end_attributes();

  script_category(ACT_GATHER_INFO);
  script_family(english:"Windows : Microsoft Bulletins");

  script_copyright(english:"This script is Copyright (C) 2017-2019 and is owned by Tenable, Inc. or an Affiliate thereof.");

  script_dependencies("smb_hotfixes.nasl", "ms_bulletin_checks_possible.nasl", "smb_check_rollup.nasl");
  script_require_keys("SMB/MS_Bulletin_Checks/Possible");
  script_require_ports(139, 445, "Host/patch_management_checks");

  exit(0);
}

include("audit.inc");
include("smb_hotfixes_fcheck.inc");
include("smb_hotfixes.inc");
include("smb_func.inc");
include("misc_func.inc");

get_kb_item_or_exit("SMB/MS_Bulletin_Checks/Possible");

bulletin = 'MS17-006';
kbs = make_list(
  '4012204', # ie9 ; vista and 2008
  '3218362', # ie9 ; api messaging ; vista and 2008
  '4012204', # ie10 sec rollup ; 2012
  '4012217', # ie10 reg rollup ; 2012
  '4012204', # ie11 sec rollup ; 7 and 2008 r2
  '4012215', # ie11 reg rollup ; 7 and 2008 r2
  '4012204', # ie11 sec rollup ; 8.1 and 2012 r2
  '4012216', # ie11 reg rollup ; 8.1 and 2012 r2
  '4012606', # ie11 rollup ; win 10
  '4013198', # ie11 rollup ; win 10 1511
  '4013429'  # ie11 rollup ; win 10 1607
);

if (get_kb_item("Host/patch_management_checks")) hotfix_check_3rd_party(bulletin:bulletin, kbs:kbs, severity:SECURITY_HOLE);

get_kb_item_or_exit("SMB/Registry/Enumerated");
get_kb_item_or_exit("SMB/WindowsVersion", exit_code:1);

if (hotfix_check_sp_range(vista:'2', win7:'1', win8:'0',  win81:'0', win10:'0') <= 0) audit(AUDIT_OS_SP_NOT_VULN);

productname = get_kb_item_or_exit("SMB/ProductName", exit_code:1);
if ("Windows 8" >< productname && "8.1" >!< productname)
 audit(AUDIT_OS_SP_NOT_VULN);

if (hotfix_check_server_core() == 1) audit(AUDIT_WIN_SERVER_CORE);

share = hotfix_get_systemdrive(as_share:TRUE, exit_on_fail:TRUE);
if (!is_accessible_share(share:share)) audit(AUDIT_SHARE_FAIL, share);

if (
  # Windows 10 1607
  smb_check_rollup(os:"10", sp:0, os_build:"14393", rollup_date: "03_2017", bulletin:bulletin, rollup_kb_list:make_list(4013429)) ||
  # Windows 10 1511
  smb_check_rollup(os:"10", sp:0, os_build:"10586", rollup_date: "03_2017", bulletin:bulletin, rollup_kb_list:make_list(4013198)) ||
  # Windows 10
  smb_check_rollup(os:"10", sp:0, os_build:"10240", rollup_date: "03_2017", bulletin:bulletin, rollup_kb_list:make_list(4012606)) ||

  # Windows 8.1 / Windows Server 2012 R2
  # Internet Explorer 11
  ( smb_check_rollup(os:"6.3", sp:0, rollup_date: "03_2017", bulletin:bulletin, rollup_kb_list:make_list(4012216)) &&
    hotfix_is_vulnerable(os:"6.3", sp:0, file:"mshtml.dll", version:"11.0.9600.18618", min_version:"11.0.9600.16000", dir:"\system32", bulletin:bulletin, kb:"4012204")) ||

  # Windows Server 2012
  # Internet Explorer 10
  ( smb_check_rollup(os:"6.2", sp:0, rollup_date: "03_2017", bulletin:bulletin, rollup_kb_list:make_list(4012217)) &&
    hotfix_is_vulnerable(os:"6.2", sp:0, file:"mshtml.dll", version:"10.0.9200.22104", min_version:"10.0.9200.16000", dir:"\system32", bulletin:bulletin, kb:"4012204")) ||

  # Windows 7 / Server 2008 R2
  # Internet Explorer 11
  ( smb_check_rollup(os:"6.1", sp:1, rollup_date: "03_2017", bulletin:bulletin, rollup_kb_list:make_list(4012215)) &&
    hotfix_is_vulnerable(os:"6.1", sp:1, file:"mshtml.dll", version:"11.0.9600.18618", min_version:"11.0.9600.16000", dir:"\system32", bulletin:bulletin, kb:"4012204")) ||

  # Vista / Windows Server 2008
  # Internet Explorer 9
  hotfix_is_vulnerable(os:"6.0", sp:2, file:"mshtml.dll", version:"9.0.8112.20985", min_version:"9.0.8112.20000", dir:"\system32", bulletin:bulletin, kb:"4012204") ||
  hotfix_is_vulnerable(os:"6.0", sp:2, file:"mshtml.dll", version:"9.0.8112.16871", min_version:"9.0.8112.16000", dir:"\system32", bulletin:bulletin, kb:"4012204") ||

  # KB 3218362 / Vista and Windows Server 2008 / Inetcomm.dll
  hotfix_is_vulnerable(os:"6.0", sp:2, file:"inetcomm.dll", version:"6.0.6002.24052", min_version:"6.0.6002.23000", dir:"\system32", bulletin:bulletin, kb:"3218362") ||
  hotfix_is_vulnerable(os:"6.0", sp:2, file:"inetcomm.dll", version:"6.0.6002.19728", min_version:"6.0.6002.18000", dir:"\system32", bulletin:bulletin, kb:"3218362")
)
{
  set_kb_item(name:'SMB/Missing/'+bulletin, value:TRUE);
  hotfix_security_hole();
  hotfix_check_fversion_end();
}
else
{
  hotfix_check_fversion_end();
  audit(AUDIT_HOST_NOT, hotfix_get_audit_report());
}

Seebug

bulletinFamilyexploit
descriptionOriginal link: a [Broken Browser](<https://www.brokenbrowser.com/uxss-ie-htmlfile/>) Original author: [Manuel Caballero](<https://twitter.com/magicmac2000>) Translation: **Holic (know Chong Yu 404 security lab)** Today we know from Internet Explorer since the birth there has been function. This feature allows the Web Developer instance of the external object, and therefore be the attacker to abuse. Can you guess what we're saying is what characteristics? That is [ActiveXObject](<https://msdn.microsoft.com/en-us/library/7sw4ddf8\(v=vs.94\).aspx>) . Even now it is subject to many limitations, we have not then happily show the Excel spreadsheet, but it still has a lot of play. We will build a reliable UXSS/SOP(same-origin policy around, it will allow us to access any of the domain stuff, of course including cookies, and you can imagine the stuff. However, the bug hunter, do not think that ActiveXObject is another UXSS only, his attacker is a perfect element, because it has numerous vulnerabilities, we will in this article mentioned below. I really suggest you study out of this object, you unexpectedly discover a lot of new things. ## A variety of rendering HTML containers In the browser rendering the HTML there are several ways, my first thought is an IFRAME tag, and we use the OBJECT even EMBED tag can do the same thing. Actually, there are some objects that allow us to logically render the HTML, but it is not visible. For example: [implementation. createDocument](<https://developer.mozilla.org/en-US/docs/Web/API/DOMImplementation/createDocument>), and [implementation. createHTMLDocument ](<https://developer.mozilla.org/en-US/docs/Web/API/DOMImplementation/createHTMLDocument>) even [XMLHttpRequest ](<https://developer.mozilla.org/en-US/docs/Web/API/XMLHttpRequest/responseType>) can return the document object instead of text/xml. These HTML documents with iframes/windows in a document have many similarities, but does not include all of the content. For example, some of which can't execute the script, the other without any of the associated window, so they are missing like the window. open this method. In other words, these documents have their limitations. But Internet Explorer there are several rendering HTML, my favorite is by means of an ActiveXObject to instantiate a "htmlFile"in. This type of document also has its limitations, but at least be able to run the script. Consider the following script. `javascript doc = new ActiveXObject("htmlFile");` This **ActiveXObject ** is created like [the WebBrowser control ](<https://msdn.microsoft.com/en-us/library/aa752041\(v=vs.85\).aspx>) something so basic is similar to an iframe, and==and return its document object references==。 In order to access the window object, we have to use before the parentWindow or Script, because here does not support the defaultView of. ``javascript win = doc. defaultView; // Not supported. win = doc. Script; // Returns the window object of doc. win = doc. parentWindow; // Returns the window object of doc. `` I was the “Script” of the fans, so I used this method. By the way, I'm very curious about this ActiveXObject location is what. ![](https://images.seebug.org/content/images/2017/02/01-location.png) It was fun! For me, the next question Is: this document of the window object is not, and we are treated to the same object? I mean, it has a real window or other parent element/Creator sharing. ``javascript // Remember: // win is the window object of the ActiveXObject. // window is the window object of the main window. alert(win == window); // false `` Thus, we conclude that the ActiveXObject the window is different from the main window, which means that it has its own window. I want to know now who is the top of it(top). Did ActiveXObject think of it at the top? ![](https://images.seebug.org/content/images/2017/02/02-windoweqtop.png) Wow!**win **think it belongs to the top of the top, I can not help but imagination is. It is perhaps the presence of [XFO ](<https://developer.mozilla.org/en-US/docs/Web/HTTP/Headers/X-Frame-Options>) bypass vulnerability, or to allow insecure requests for SSL top without SSL on. Write down these ideas! At least this is my habit: the fun things that come to mind, I will immediately notice, so I can continue to focus the original goal, and not let these thoughts fade away in the brain's gray matter in the ocean. Okay, I'm curious about another thing is this a document of the domain. So, what it really is? `alert(doc. domain); // The same domain as the top page` It returns the main window to the same domain, it's no big deal, but worth more testing. Thoughts in the mind flow. ## Recovery document. the domain of the top property On this point, my question first is: if we change the home page's base href, and then instantiate this ActiveX, what will happen? It will have pages with the same domain or from the base href domain? This idea can not be achieved, but when the object is created, do not underestimate the base href, because it has produced wonders, and the future may be used to. Look at me recently is how to achieve SOP bypass. In short, I tried another option: in a different domain in an iframe to create a ActiveXObject on. That is, the same code can now be from a different domain in an iframe implementation. `` `` I was surprised ActiveXObject use the top of the top of the domain instead of the iframe created. Bingo! ![](https://images.seebug.org/content/images/2017/02/03-topdomain.png) ### [[ IE11 Proof of Concept ]](<https://www.cracking.com.ar/demos/sop-ax-htmlfile/getdomain.html>) Of course, retrieve the page domain is not the complete SOP bypasses, but it is a hard evidence, indicating we are dealing with a“confusing”the browser. Problem advancing to the deep, until IE give up. With a little JavaScript, with passion and persistence, we will do. ## Pass a reference to the top Our goal now is with the ActiveXObject shared top-level window reference to see if it has the right to access. If it the document. domain and the top of the same, it should be able to access! But here there is also a challenge: from the browser's point of view, this ActiveXObject is not fully initialized. This means that we cannot create a variable, it cannot change any member values. Like a [frozen object](<https://developer.mozilla.org/en/docs/Web/JavaScript/Reference/Global_Objects/Object/freeze>), you can not to delete/change anything. `javascript oc = new ActiveXObject("htmlFile"); win = doc. Script; win. myTop = top; // Browser not initialized, the variable is not set win. execScript("alert(win. myTop)"); // undefined` In a conventional window, it is supposedly effective, and the use of ActiveXObject is not, unless we use the document. open the initialization. The problem is, if we initialize the object, IE will put it in the domain settings are correct, ignore our little trick. Then take a look at this. and figure out what I mean. `javascript doc = new ActiveXObject("htmlFile"); alert(doc. domain); // alerts the top of the domain (SOP bypass) doc. open(); // Initialize the document alert(doc. domain); // alerts the iFrame domain (No more SOP bypass)` Then how we will top-level window object is passed to the ActiveXObject? Carefully think about. Each window object has a very special place that it is in any other place are writable. What is it? opener now! Yes, the window. opener, my friend, to try it! `javascript doc = new ActiveXObject("htmlFile"); win = doc. Script; win. opener = top; win. execScript("alert(opener. document. URL)"); // Full SOP bypass` ![](https://images.seebug.org/content/images/2017/02/04-topdom.png) ### [[ IE11 Proof of Concept ]](<https://www.cracking.com.ar/demos/sop-ax-htmlfile/accesstop.html>) Yes! Use opener skills effective. Now, whether our domain, we can access to the top of the document. We of the iframe may be in another iframe, or like a [Russian doll](<https://en.wikipedia.org/wiki/Matryoshka_doll>), like unlimited nested with a different domain, but it can still access the top(top)。 This is power! Then, we get a valid UXSS, but there is still a problem: it needs to be loaded into the iframe, I don't think that the target site would be so generous in their iframe rendering our little trick, right? But the thought of today's show banner: we in the iframe is rendered, and they can access the top element! This means Facebook ads, Yahoo! Advertising and any in the iframe run in the untrusted content can access the main page. If we use Facebook, the ads can be on our behalf to publish content, access to our contacts and cookies without restrictions. We should be more further, to find one without the aid of outside method to obtain the website's cookies. How do we make it in any of the non-cooperation of the site effective? We can in no iframe in the site to achieve? Many of the solutions appear in my mind, and the most simple is: **[redirect] + [thread-blocks] + [inject] **it. This technique is super easy, but it's worth a little explanation. ## Arbitrary content injection There is a **target website, the chance to load before**, for any window/iframe to inject HTML/Script of the method, while ignoring its domain. For example, suppose we open a with the server to redirect to PayPal on the new window. In the redirect to happen before we can still access the window, but once the redirect to load a new URL, we cannot access, right? In fact, when the redirection occurs, IE render the new content before the destruction of the window of each element. However, if we are in page injected a single element, at the redirection happens before? More, after the injection, we block the thread, and don't give IE a chance to destroy the object, but let the redirect happen, what will happen? The new pages will retain the Old of the injected content, because IE can't delete it. In this case, we use alert as a thread interceptor, of course, there are other ways to achieve the same effect. Let us recall in writing code before you need to do: 1. Open a redirected to PayPal in a new window. 2. Redirection occurs before the injection of an iframe. 3. The redirection happens after the iframe being created ActiveXObject for. 4. Bang on! That's about it. Now the ActiveXObject has been having with the main window in the same domain. Here is the valid code: ``javascript w = window. open("redir. php? URL=https://www. paypal. com"); // Create and inject an iframe in the target window ifr = w. document. createElement('iframe'); w. document. appendChild(ifr); // Initialize the iframe w[0]. document. open(); w[0]. document. close(); // Pass a reference to the top window // So the iframe can access even after the redirect. w[0]. _top = w; // Finally, once the Paypal is loaded (or loading, same thing) we create the // ActiveXObject within the injected iframe. w[0]. setTimeout('alert("[ Thread Blocked to prevent the iFrame Vegas ]\\n\\nClose this alert once the address bar changes to the target site.");' + 'doc = new ActiveXObject("htmlFile");' + 'doc. Script. opener = _top;' + 'doc. Script. setTimeout("opener. location = \'javascript:alert(document. all[0]. outerHTML)\'");'); `` ### [[ IE11 Proof of Concept ]](<https://www.cracking.com.ar/demos/sop-ax-htmlfile/injectiframexdom.html>) ![](https://images.seebug.org/content/images/2017/02/05-fullxdom.png) bug hunter, not in this pause. Continue to explore ActiveXObject, because it is filled with wait for you you discover the object. And you can put this PoC becomes more clean, with less code? You can not use the alert to establish a thread is blocked? Good luck! I say good luck? Oh no, sorry. What I mean is: continue until you find the bug. If this to you means luck, so good luck! But for me, this means that the passion and persistence. And the only need is to find security vulnerabilities.
idSSV:92802
last seen2017-11-19
modified2017-03-20
published2017-03-20
reporterRoot
titleMicrosoft Internet Explorer Elevation of Privilege Vulnerability (CVE-2017-0154)