Vulnerabilities > CVE-2015-1644 - Permissions, Privileges, and Access Controls vulnerability in Microsoft products

047910
CVSS 7.2 - HIGH
Attack vector
LOCAL
Attack complexity
LOW
Privileges required
NONE
Confidentiality impact
COMPLETE
Integrity impact
COMPLETE
Availability impact
COMPLETE
local
low complexity
microsoft
CWE-264
nessus

Summary

Microsoft Windows Server 2003 SP2, Windows Vista SP2, Windows Server 2008 SP2 and R2 SP1, Windows 7 SP1, Windows 8, Windows 8.1, Windows Server 2012 Gold and R2, and Windows RT Gold and 8.1 do not properly constrain impersonation levels, which allows local users to gain privileges via a crafted application, aka "Windows MS-DOS Device Name Vulnerability."

Common Attack Pattern Enumeration and Classification (CAPEC)

  • Accessing, Modifying or Executing Executable Files
    An attack of this type exploits a system's configuration that allows an attacker to either directly access an executable file, for example through shell access; or in a possible worst case allows an attacker to upload a file and then execute it. Web servers, ftp servers, and message oriented middleware systems which have many integration points are particularly vulnerable, because both the programmers and the administrators must be in synch regarding the interfaces and the correct privileges for each interface.
  • Leverage Executable Code in Non-Executable Files
    An attack of this type exploits a system's trust in configuration and resource files, when the executable loads the resource (such as an image file or configuration file) the attacker has modified the file to either execute malicious code directly or manipulate the target process (e.g. application server) to execute based on the malicious configuration parameters. Since systems are increasingly interrelated mashing up resources from local and remote sources the possibility of this attack occurring is high. The attack can be directed at a client system, such as causing buffer overrun through loading seemingly benign image files, as in Microsoft Security Bulletin MS04-028 where specially crafted JPEG files could cause a buffer overrun once loaded into the browser. Another example targets clients reading pdf files. In this case the attacker simply appends javascript to the end of a legitimate url for a pdf (http://www.gnucitizen.org/blog/danger-danger-danger/) http://path/to/pdf/file.pdf#whatever_name_you_want=javascript:your_code_here The client assumes that they are reading a pdf, but the attacker has modified the resource and loaded executable javascript into the client's browser process. The attack can also target server processes. The attacker edits the resource or configuration file, for example a web.xml file used to configure security permissions for a J2EE app server, adding role name "public" grants all users with the public role the ability to use the administration functionality. The server trusts its configuration file to be correct, but when they are manipulated, the attacker gains full control.
  • Blue Boxing
    This type of attack against older telephone switches and trunks has been around for decades. A tone is sent by an adversary to impersonate a supervisor signal which has the effect of rerouting or usurping command of the line. While the US infrastructure proper may not contain widespread vulnerabilities to this type of attack, many companies are connected globally through call centers and business process outsourcing. These international systems may be operated in countries which have not upgraded Telco infrastructure and so are vulnerable to Blue boxing. Blue boxing is a result of failure on the part of the system to enforce strong authorization for administrative functions. While the infrastructure is different than standard current applications like web applications, there are historical lessons to be learned to upgrade the access control for administrative functions.
  • Restful Privilege Elevation
    Rest uses standard HTTP (Get, Put, Delete) style permissions methods, but these are not necessarily correlated generally with back end programs. Strict interpretation of HTTP get methods means that these HTTP Get services should not be used to delete information on the server, but there is no access control mechanism to back up this logic. This means that unless the services are properly ACL'd and the application's service implementation are following these guidelines then an HTTP request can easily execute a delete or update on the server side. The attacker identifies a HTTP Get URL such as http://victimsite/updateOrder, which calls out to a program to update orders on a database or other resource. The URL is not idempotent so the request can be submitted multiple times by the attacker, additionally, the attacker may be able to exploit the URL published as a Get method that actually performs updates (instead of merely retrieving data). This may result in malicious or inadvertent altering of data on the server.
  • Target Programs with Elevated Privileges
    This attack targets programs running with elevated privileges. The attacker would try to leverage a bug in the running program and get arbitrary code to execute with elevated privileges. For instance an attacker would look for programs that write to the system directories or registry keys (such as HKLM, which stores a number of critical Windows environment variables). These programs are typically running with elevated privileges and have usually not been designed with security in mind. Such programs are excellent exploit targets because they yield lots of power when they break. The malicious user try to execute its code at the same level as a privileged system call.

Msbulletin

bulletin_idMS15-038
bulletin_url
date2015-04-14T00:00:00
impactElevation of Privilege
knowledgebase_id3045685
knowledgebase_url
severityImportant
titleVulnerabilities in Microsoft Windows Could Allow Elevation of Privilege

Nessus

NASL familyWindows : Microsoft Bulletins
NASL idSMB_NT_MS15-038.NASL
descriptionThe remote Windows host is missing a security update. It is, therefore, affected by multiple privilege escalation vulnerabilities : - A elevation of privilege vulnerability exists due to NtCreateTransactionManager type confusion that allows an authenticated attacker to bypass impersonation-level security checks by running a specially crafted application. (CVE-2015-1643) - A elevation of privilege vulnerability exists due to a MS-DOS device name handling flaw that allows an authenticated attacker to bypass impersonation-level security checks by running a specially crafted application. (CVE-2015-1644)
last seen2020-06-01
modified2020-06-02
plugin id82774
published2015-04-14
reporterThis script is Copyright (C) 2015-2018 Tenable Network Security, Inc.
sourcehttps://www.tenable.com/plugins/nessus/82774
titleMS15-038: Vulnerabilities in Microsoft Windows Could Allow Elevation of Privilege (3049576)
code
#
# (C) Tenable Network Security, Inc.
#

include("compat.inc");

if (description)
{
  script_id(82774);
  script_version("1.9");
  script_cvs_date("Date: 2018/11/15 20:50:31");

  script_cve_id("CVE-2015-1643", "CVE-2015-1644");
  script_bugtraq_id(73998, 74014);
  script_xref(name:"MSFT", value:"MS15-038");
  script_xref(name:"MSKB", value:"3045685");
  script_xref(name:"MSKB", value:"3045999");
  script_xref(name:"IAVA", value:"2015-A-0091");

  script_name(english:"MS15-038: Vulnerabilities in Microsoft Windows Could Allow Elevation of Privilege (3049576)");
  script_summary(english:"Checks the version of clfs.sys and ntdll.dll.");

  script_set_attribute(attribute:"synopsis", value:
"The remote Windows host is affected by multiple privilege escalation
vulnerabilities.");
  script_set_attribute(attribute:"description", value:
"The remote Windows host is missing a security update. It is,
therefore, affected by multiple privilege escalation vulnerabilities :

  - A elevation of privilege vulnerability exists due to
    NtCreateTransactionManager type confusion that allows
    an authenticated attacker to bypass impersonation-level
    security checks by running a specially crafted
    application. (CVE-2015-1643)

  - A elevation of privilege vulnerability exists due to a
    MS-DOS device name handling flaw that allows an
    authenticated attacker to bypass impersonation-level
    security checks by running a specially crafted
    application. (CVE-2015-1644)");
  script_set_attribute(attribute:"see_also", value:"https://docs.microsoft.com/en-us/security-updates/SecurityBulletins/2015/ms15-038");
  script_set_attribute(attribute:"solution", value:
"Microsoft has released a set of patches for Windows 2003, Vista, 2008,
7, 2008 R2, 8, 2012, 8.1, and 2012 R2.");
  script_set_cvss_base_vector("CVSS2#AV:L/AC:L/Au:N/C:C/I:C/A:C");
  script_set_cvss_temporal_vector("CVSS2#E:F/RL:OF/RC:C");
  script_set_attribute(attribute:"exploitability_ease", value:"Exploits are available");
  script_set_attribute(attribute:"exploit_available", value:"true");
  script_set_attribute(attribute:"exploit_framework_core", value:"true");

  script_set_attribute(attribute:"vuln_publication_date", value:"2015/04/14");
  script_set_attribute(attribute:"patch_publication_date", value:"2015/04/14");
  script_set_attribute(attribute:"plugin_publication_date", value:"2015/04/14");

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

  script_set_attribute(attribute:"stig_severity", value:"II");
  script_end_attributes();

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

  script_copyright(english:"This script is Copyright (C) 2015-2018 Tenable Network Security, Inc.");

  script_dependencies("smb_hotfixes.nasl", "ms_bulletin_checks_possible.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 = 'MS15-038';

kbs = make_list("3045685","3045999");
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(win2003:'2', vista:'2', win7:'1', win8:'0', win81:'0') <= 0) audit(AUDIT_OS_SP_NOT_VULN);

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

# The 2k3 checks could flag XP 64, which is unsupported
productname = get_kb_item_or_exit("SMB/ProductName", exit_code:1);
if ("Windows XP" >< productname) audit(AUDIT_OS_SP_NOT_VULN);

if (
  # Windows 8.1 / 2012 R2
  hotfix_is_vulnerable(os:"6.3", file:"clfs.sys", version:"6.3.9600.17719", min_version:"6.3.9600.16000", dir:"\drivers", bulletin:bulletin, kb:"3045685") ||
  hotfix_is_vulnerable(os:"6.3", file:"ntdll.dll", version:"6.3.9600.17736", min_version:"6.3.9600.16000", dir:"\system32", bulletin:bulletin, kb:"3045999") ||

  # Windows 8 / 2012
  hotfix_is_vulnerable(os:"6.2", file:"clfs.sys", version:"6.2.9200.21408", min_version:"6.2.9200.20000", dir:"\drivers", bulletin:bulletin, kb:"3045685") ||
  hotfix_is_vulnerable(os:"6.2", file:"clfs.sys", version:"6.2.9200.17291", min_version:"6.2.9200.16000", dir:"\drivers", bulletin:bulletin, kb:"3045685") ||
  hotfix_is_vulnerable(os:"6.2", file:"ntdll.dll", version:"6.2.9200.21428", min_version:"6.2.9200.20000", dir:"\system32", bulletin:bulletin, kb:"3045999") ||
  hotfix_is_vulnerable(os:"6.2", file:"ntdll.dll", version:"6.2.9200.17313", min_version:"6.2.9200.16000", dir:"\system32", bulletin:bulletin, kb:"3045999") ||

  # Windows 7 / 2008 R2
  hotfix_is_vulnerable(os:"6.1", sp:1, file:"clfs.sys", version:"6.1.7601.22981", min_version:"6.1.7601.22000", dir:"\system32", bulletin:bulletin, kb:"3045685") ||
  hotfix_is_vulnerable(os:"6.1", sp:1, file:"clfs.sys", version:"6.1.7601.18777", min_version:"6.1.7600.18000", dir:"\system32", bulletin:bulletin, kb:"3045685") ||
  hotfix_is_vulnerable(os:"6.1", sp:1, file:"ntdll.dll", version:"6.1.7601.23002", min_version:"6.1.7601.22000", dir:"\system32", bulletin:bulletin, kb:"3045999") ||
  hotfix_is_vulnerable(os:"6.1", sp:1, file:"ntdll.dll", version:"6.1.7601.18798", min_version:"6.1.7600.18000", dir:"\system32", bulletin:bulletin, kb:"3045999") ||

  # Vista / 2008
  hotfix_is_vulnerable(os:"6.0", sp:2, file:"clfs.sys", version:"6.0.6002.23639", min_version:"6.0.6002.23000", dir:"\system32", bulletin:bulletin, kb:"3045685") ||
  hotfix_is_vulnerable(os:"6.0", sp:2, file:"clfs.sys", version:"6.0.6002.19331", min_version:"6.0.6002.18000", dir:"\system32", bulletin:bulletin, kb:"3045685") ||
  hotfix_is_vulnerable(os:"6.0", sp:2, file:"ntdll.dll", version:"6.0.6002.23654", min_version:"6.0.6002.23000", dir:"\system32", bulletin:bulletin, kb:"3045999") ||
  hotfix_is_vulnerable(os:"6.0", sp:2, file:"ntdll.dll", version:"6.0.6002.19346", min_version:"6.0.6002.18000", dir:"\system32", bulletin:bulletin, kb:"3045999") ||

  # Windows 2003
  hotfix_is_vulnerable(os:"5.2", sp:2, file:"clfs.sys", version:"5.2.3790.5602", dir:"\system32", bulletin:bulletin, kb:"3045685") ||
  ("2003 R2" >!< productname && # Windows 2003 R2 is not affected
  hotfix_is_vulnerable(os:"5.2", sp:2, file:"ntdll.dll", version:"5.2.3790.5583", dir:"\system32", bulletin:bulletin, kb:"3045999"))

)
{
  set_kb_item(name:"SMB/Missing/"+bulletin, value:TRUE);
  hotfix_security_hole();
  hotfix_check_fversion_end();
  exit(0);
}
else
{
  hotfix_check_fversion_end();
  audit(AUDIT_HOST_NOT, 'affected');
}

Seebug

bulletinFamilyexploit
description### Summary: When accessing an OOP COM object using IRemUnknown2 the local unmarshaled proxy can be for a different interface to that requested by QueryInterface resulting in a type confusion which can result in EoP. ### Description: Querying for an IID on a OOP (or remote) COM object calls the ORPC method RemQueryInterface or RemQueryInterface2 on the default proxy. This request is passed to the remote object which queries the implementation object and if successful returns a marshaled representation of that interface to the caller. The difference between RemQueryInterface and RemQueryInterface2 (RQI2) is how the objects are passed back to the caller. For RemQueryInterface the interface is passed back as a STDOBJREF which only contains the basic OXID/OID/IPID information to connect back. RemQueryInterface2 on the other hand passes back MInterfacePointer structures which is an entire OBJREF. The rationale, as far as I can tell, is that RQI2 is used for implementing in-process handlers, some interfaces can be marshaled using the standard marshaler and others can be custom marshaled. This is exposed through the Aggregate Standard Marshaler. The bug lies in the implementation of unpacking the results of the the RQI2 request in CStdMarshal::Finish_RemQIAndUnmarshal2. For each MInterfacePointer CStdMarshal::UnmarshalInterface is called passing the IID of the expected interface and the binary data wrapped in an IStream. CStdMarshal::UnmarshalInterface blindly unmarshals the interface, which creates a local proxy object but the proxy is created for the IID in the OBJREF stream and NOT the IID requested in RQI2. No further verification occurs at this point and the created proxy is passed back up the call stack until the received by the caller (through a void** obviously). If the IID in the OBJREF doesn’t match the IID requested the caller doesn’t know, if it calls any methods on the expected interface it will be calling a type confused object. This could result in crashes in the caller when it tries to access methods on the expected interface which aren’t there or are implemented differently. You could probably also return a standard OBJREF to a object local to the caller, this will result in returning the local object itself which might have more scope for exploiting the type confusion. In order to get the caller to use RQI2 we just need to pass it back an object which is custom marshaled with the Aggregate Standard Marshaler. This will set a flag on the marshaler which indicates to always use the aggregate marshaler which results in using RQI2 instead of RQI. As this class is a core component of COM it’s trusted and so isn’t affected by the EOAC_NO_CUSTOM_MARSHAL setting. In order to exploit this a different caller needs to call QueryInterface on an object under a less trusted user's control. This could be a more privileged user (such as a sandbox broker), or a privileged service. This is pretty easy pattern to find, any method in an exposed interface on a more trusted COM object which takes an interface pointer or variant would potentially be vulnerable. For example IPersistStream takes an IStream interface pointer and will call methods on it. Another type of method is one of the various notification interfaces such as IBackgroundCopyCallback for BITS. This can probably also be used remotely if the attacker has the opportunity to inject an OBJREF stream into a connection which is set to CONNECT level security (which seems to be the default activation security). On to exploitation, as you well know I’ve little interest in exploiting memory corruptions, especially as this would either this will trigger CFG on modern systems or would require a very precise lineup of expected method and actual called method which could be tricky to exploit reliably. However I think at least using this to escape a sandbox it might be your only option. So I’m not going to do that, instead I’m going to exploit it logically, the only problem is this is probably unexploitable from a sandbox (maybe) and requires a very specific type of callback into our object. The thing I’m going to exploit is in the handling of OLE Automation auto-proxy creation from type libraries. When you implement an Automation compatible object you could implement an explicit proxy but if you’ve already got a Type library built from your IDL then OLEAUT32 provides an alternative. If you register your interface with a Proxy CLSID for PSOAInterface or PSDispatch then instead of loading your PS DLL it will load OLEAUT32. The proxy loader code will lookup the interface entry for the passed IID to see if there’s a registered type library associated with it. If there is the code will call LoadTypeLib on that library and look up the interface entry in the type library. It will then construct a custom proxy object based on the type library information. The trick here is while in general we don’t control the location of the type library (so it’s probably in a location we can write to such as system32) if we can get an object unmarshaled which indicates it’s IID is one of these auto-proxy interfaces while the privileged service is impersonating us we can redirect the C: drive to anywhere we like and so get the service to load an arbitrary type library file instead of a the system one. One easy place where this exact scenario occurs is in the aforementioned BITS SetNotifyInterface function. The service first impersonates the caller before calling QI on the notify interface. We can then return an OBJREF for a automation IID even though the service asked for a BITS callback interface. So what? Well it’s been known for almost 10 years that the Type library file format is completely unsafe. It was reported and it wasn’t changed, Tombkeeper highlighted this in his “Sexrets [sic] of LoadLibrary” presentation at CSW 2015. You can craft a TLB which will directly control EIP. Now you’d assume therefore I’m trading a unreliable way of getting EIP control for one which is much easier, if you assume that you’d be wrong. Instead I’m going to abuse the fact that TLBs can have referenced type libraries, which is used instead of embedding the type definitions inside the TLB itself. When a reference type is loaded the loader will try and look up the TLB by its GUID, if that fails it will take the filename string and pass it verbatim to LoadTypeLib. It’s a lesser know fact that this function, if it fails to find a file with the correct name will try and parse the name as a moniker. Therefore we can insert a scriptlet moniker into the type library, when the auto-proxy generator tries to find how many functions the interface implements it walks the inheritance chain, which causes the referenced TLB to be loaded, which causes a scriptlet moniker to be loaded and bound which results in arbitrary execution in a scripting language inside the privileged COM caller. The need to replace the C: drive is why this won’t work as a sandbox escape. Also it's a more general technique, not specific to this vulnerability as such, you could exploit it in the low-level NDR marshaler layer, however it’s rare to find something impersonating the caller during the low-level unmarshal. Type libraries are not loaded using the flag added after CVE-2015-1644 which prevent DLLs being loaded from the impersonate device map. I think you might want to fix this as well as there’s other places and scenarios this can occur, for example there’s a number of WMI services (such as anything which touches GPOs) which result in the ActiveDS com object being created, this is automation compatible and so will load a type library while impersonating the caller. Perhaps the auto-proxy generated should temporarily disable impersonation when loading the type library to prevent this happening. ### Technologies Affected * Microsoft Windows 10 Version 1607 for 32-bit Systems * Microsoft Windows 10 Version 1607 for x64-based Systems * Microsoft Windows 10 for 32-bit Systems * Microsoft Windows 10 for x64-based Systems * Microsoft Windows 10 version 1511 for 32-bit Systems * Microsoft Windows 10 version 1511 for x64-based Systems * Microsoft Windows 10 version 1703 for 32-bit Systems * Microsoft Windows 10 version 1703 for x64-based Systems * Microsoft Windows 7 for 32-bit Systems SP1 * Microsoft Windows 7 for x64-based Systems SP1 * Microsoft Windows 8.1 for 32-bit Systems * Microsoft Windows 8.1 for x64-based Systems * Microsoft Windows RT 8.1 * Microsoft Windows Server 2008 R2 for Itanium-based Systems SP1 * Microsoft Windows Server 2008 R2 for x64-based Systems SP1 * Microsoft Windows Server 2008 for 32-bit Systems SP2 * Microsoft Windows Server 2008 for Itanium-based Systems SP2 * Microsoft Windows Server 2008 for x64-based Systems SP2 * Microsoft Windows Server 2012 * Microsoft Windows Server 2012 R2 * Microsoft Windows Server 2016 ### Proof of Concept `https://github.com/WindowsExploits/Exploits/tree/master/CVE-2017-0213`
idSSV:96267
last seen2017-11-19
modified2017-07-04
published2017-07-04
reporterRoot
titleMicrosoft Windows COM Local Privilege Escalation Vulnerability(CVE-2017-0213)