Related Weaknesses
CWE-ID |
Weakness Name |
Source |
CWE-20 |
Improper Input Validation The product receives input or data, but it does
not validate or incorrectly validates that the input has the
properties that are required to process the data safely and
correctly. |
|
Metrics
Metrics |
Score |
Severity |
CVSS Vector |
Source |
V3.0 |
7.8 |
HIGH |
CVSS:3.0/AV:L/AC:L/PR:N/UI:R/S:U/C:H/I:H/A:H
Base: Exploitabilty MetricsThe Exploitability metrics reflect the characteristics of the thing that is vulnerable, which we refer to formally as the vulnerable component. Attack Vector This metric reflects the context by which vulnerability exploitation is possible. A vulnerability exploitable with Local access means that the vulnerable component is not bound to the network stack, and the attacker's path is via read/write/execute capabilities. In some cases, the attacker may be logged in locally in order to exploit the vulnerability, otherwise, she may rely on User Interaction to execute a malicious file. Attack Complexity This metric describes the conditions beyond the attacker's control that must exist in order to exploit the vulnerability. Specialized access conditions or extenuating circumstances do not exist. An attacker can expect repeatable success against the vulnerable component. Privileges Required This metric describes the level of privileges an attacker must possess before successfully exploiting the vulnerability. The attacker is unauthorized prior to attack, and therefore does not require any access to settings or files to carry out an attack. User Interaction This metric captures the requirement for a user, other than the attacker, to participate in the successful compromise of the vulnerable component. Successful exploitation of this vulnerability requires a user to take some action before the vulnerability can be exploited. For example, a successful exploit may only be possible during the installation of an application by a system administrator. Base: Scope MetricsAn important property captured by CVSS v3.0 is the ability for a vulnerability in one software component to impact resources beyond its means, or privileges. Scope Formally, Scope refers to the collection of privileges defined by a computing authority (e.g. an application, an operating system, or a sandbox environment) when granting access to computing resources (e.g. files, CPU, memory, etc). These privileges are assigned based on some method of identification and authorization. In some cases, the authorization may be simple or loosely controlled based upon predefined rules or standards. For example, in the case of Ethernet traffic sent to a network switch, the switch accepts traffic that arrives on its ports and is an authority that controls the traffic flow to other switch ports. An exploited vulnerability can only affect resources managed by the same authority. In this case the vulnerable component and the impacted component are the same. Base: Impact MetricsThe Impact metrics refer to the properties of the impacted component. Confidentiality Impact This metric measures the impact to the confidentiality of the information resources managed by a software component due to a successfully exploited vulnerability. There is total loss of confidentiality, resulting in all resources within the impacted component being divulged to the attacker. Alternatively, access to only some restricted information is obtained, but the disclosed information presents a direct, serious impact. For example, an attacker steals the administrator's password, or private encryption keys of a web server. Integrity Impact This metric measures the impact to integrity of a successfully exploited vulnerability. Integrity refers to the trustworthiness and veracity of information. There is a total loss of integrity, or a complete loss of protection. For example, the attacker is able to modify any/all files protected by the impacted component. Alternatively, only some files can be modified, but malicious modification would present a direct, serious consequence to the impacted component. Availability Impact This metric measures the impact to the availability of the impacted component resulting from a successfully exploited vulnerability. There is total loss of availability, resulting in the attacker being able to fully deny access to resources in the impacted component; this loss is either sustained (while the attacker continues to deliver the attack) or persistent (the condition persists even after the attack has completed). Alternatively, the attacker has the ability to deny some availability, but the loss of availability presents a direct, serious consequence to the impacted component (e.g., the attacker cannot disrupt existing connections, but can prevent new connections; the attacker can repeatedly exploit a vulnerability that, in each instance of a successful attack, leaks a only small amount of memory, but after repeated exploitation causes a service to become completely unavailable). Temporal MetricsThe Temporal metrics measure the current state of exploit techniques or code availability, the existence of any patches or workarounds, or the confidence that one has in the description of a vulnerability. Environmental Metrics
|
[email protected] |
V2 |
9.3 |
|
AV:N/AC:M/Au:N/C:C/I:C/A:C |
[email protected] |
EPSS
EPSS is a scoring model that predicts the likelihood of a vulnerability being exploited.
EPSS Score
The EPSS model produces a probability score between 0 and 1 (0 and 100%). The higher the score, the greater the probability that a vulnerability will be exploited.
EPSS Percentile
The percentile is used to rank CVE according to their EPSS score. For example, a CVE in the 95th percentile according to its EPSS score is more likely to be exploited than 95% of other CVE. Thus, the percentile is used to compare the EPSS score of a CVE with that of other CVE.
Exploit information
Exploit Database EDB-ID : 40257
Publication date : 2016-08-16 22h00 +00:00
Author : Google Security Research
EDB Verified : Yes
Source: https://bugs.chromium.org/p/project-zero/issues/detail?id=828
The Microsoft GDI+ implementation of the EMF format supports records corresponding to the ExtTextOutA() and PolyTextOutA() API functions. Both CEmfPlusEnumState::ExtTextOutA and CEmfPlusEnumState::PolyTextOutA handlers suffer from a security vulnerability in the handling of the "offDx" record field, which is described in the following way in the format specification:
--- cut ---
offDx (4 bytes): A 32-bit unsigned integer that specifies the offset to an intercharacter spacing
array, in bytes, from the start of the record in which this object is contained. This value MUST be
32-bit aligned.
--- cut ---
The offset is supposed to address an array of "Chars" (another field in the text records, specifying the number of characters to be displayed) double words, taking up a total of 4 * N bytes. However, instead of verifying that the provided record is sufficiently large to contain 4 * N bytes at the specified offset, it only checks if it can fit 4 bytes (completely ignoring the actual number of characters in the message, which can be larger than 1). A pseudo-code of the current, vulnerable code is shown below:
--- cut ---
if ( record_size - offString >= nChars && (!nChars || record_size - 4 >= record->emrtext.offDx) ) {
// Validation passed, continue processing the record.
}
--- cut ---
There is definitely a flaw in the implementation, but one which would typically only lead to an out-of-bound read condition, since it's a problem with the sanitization of an input buffer. However, the logic found in the remainder of the function is as follows:
- Attempt to convert the textual ANSI string in the record to a wide-char string, using the MultiByteToWideChar() function and the code page specified in the most recently selected font.
- If the number of characters converted is equal to the number of bytes in the input buffer, CEmfPlusEnumState::PlayExtTextOut() is called and the function returns.
- Otherwise, the function proceeds to rewrite the offDx buffer by calling EmfEnumState::CreateCopyOfCurrentRecord() to allocate an exact copy of the current record (with the same size), and then copying entries of the intercharacter spacing array, omitting those corresponding to bytes which cause the IsDBCSLeadByteEx() function to return true. Once the rewriting is performed, CEmfPlusEnumState::PlayExtTextOut() is called with the new record as the parameter.
In order to trigger the more interesting array rewriting behavior, we must get the MultiByteToWideChar() function to convert fewer characters than there are bytes in the input buffer, which means we have to utilize a string in a non-standard encoding, which supports double-byte character sets (DBCS). Luckily, this is possible by selecting a font with an appropriate charset (e.g. SHIFTJIS_CHARSET) into the HDC, and invoking either of the *TextOutA() handlers with a byte stream containing so-called lead bytes (which folds two bytes into a single character, decreasing the eventual return value of the MultiByteToWideChar() call).
Since the spacing array in the new record is too small to store entries for all "Chars" characters, it is overflown with data read from memory after the original record buffer. Considering the complexity of the EMF format, other records in the picture file could be easily used to massage the heap such that the record copy is overflown with fully controlled data. The issue has been reproduced in Microsoft Office 2013, as well as a simple C++ program which boils down to the following calls:
--- cut ---
Graphics graphics(hdc);
Metafile *mf = new Metafile(L"C:\\path\\to\\poc.emf");
INT conversionSuccess;
mf->ConvertToEmfPlus(&graphics, &conversionSuccess, Gdiplus::EmfTypeEmfPlusDual, NULL);
--- cut ---
An example crash log from PowerPoint 2013, indicating heap corruption, is shown below (the condition can also be reproduced reliably by enabling Page Heap on the GDI+ client process):
--- cut ---
(2a8c.2bd8): Break instruction exception - code 80000003 (first chance)
eax=00000000 ebx=00000000 ecx=772336ab edx=0022cb85 esi=03bd0000 edi=1171ffc0
eip=7728e815 esp=0022cdd8 ebp=0022ce50 iopl=0 nv up ei pl nz na pe nc
cs=0023 ss=002b ds=002b es=002b fs=0053 gs=002b efl=00200206
ntdll!RtlReportCriticalFailure+0x29:
7728e815 cc int 3
0:000> kb
ChildEBP RetAddr Args to Child
0022ce50 7728f749 c0000374 772c4270 0022ce94 ntdll!RtlReportCriticalFailure+0x29
0022ce60 7728f829 00000002 64dc1326 03bd0000 ntdll!RtlpReportHeapFailure+0x21
0022ce94 7724ab46 0000000c 03bd0000 1171ffc0 ntdll!RtlpLogHeapFailure+0xa1
0022cf84 771f3431 00000258 00000260 03bd00c4 ntdll!RtlpAllocateHeap+0x7b2
0022d008 695071ec 03bd0000 00000000 00000258 ntdll!RtlAllocateHeap+0x23a
0022d01c 6951bbf1 00000258 116b5104 03bdd558 gdiplus!GpMalloc+0x16
0022d030 69557185 116b50e0 116b50e0 03bdd558 gdiplus!GpGraphics::Save+0x11
0022d4b0 69557bdc 116b50e0 116b5104 116b30d8 gdiplus!CEmfPlusEnumState::PlayExtTextOut+0xda
0022d4ec 69557f25 00000053 03bdae00 00006044 gdiplus!CEmfPlusEnumState::ExtTextOutA+0x136
0022d500 695286ca 00000053 00006044 0d67b568 gdiplus!CEmfPlusEnumState::ProcessRecord+0x13b
0022d51c 69528862 00000053 00000000 00006044 gdiplus!GdipPlayMetafileRecordCallback+0x6c
0022d544 768155f4 9d211b17 0d567180 0d67b568 gdiplus!EnumEmfDownLevel+0x6e
0022d5d0 6952aa36 9d211b17 403581b3 695287f4 GDI32!bInternalPlayEMF+0x6a3
0022d608 6952d199 9d211b17 05462305 0122d674 gdiplus!MetafilePlayer::EnumerateEmfRecords+0x104
0022d6b0 6952f455 00000000 05462305 0022d7d8 gdiplus!GpGraphics::EnumEmf+0x391
0022d810 69534742 00000000 42901225 42901d0b gdiplus!GpMetafile::EnumerateForPlayback+0x7b9
0022d90c 695347c6 03bd2fd8 00000000 00000000 gdiplus!GpGraphics::DrawImage+0x3f5
0022d970 6952c792 03bd2fd8 0022d9e4 0022d9e4 gdiplus!GpGraphics::DrawImage+0x51
0022d9a8 6952ea7a 03bd2fd8 0022d9e4 00000004 gdiplus!GpGraphics::DrawMetafileSplit+0x1f
0022d9fc 6952f4d5 03bdc438 0022dadc 00000000 gdiplus!GpMetafile::ConvertToEmfPlus+0x1c1
0022da20 69504f71 03bdc438 0022dadc 00000004 gdiplus!GpMetafile::ConvertToEmfPlus+0x1d
0022da5c 54793044 03bdc438 03bd2fd8 0022dadc gdiplus!GdipConvertToEmfPlus+0xbf
WARNING: Stack unwind information not available. Following frames may be wrong.
0022daf0 548c7b8d 00000000 03bdc438 b93aea31 oart!Ordinal3385+0x7e8
0022df18 548c749b 0022e3a4 094c4380 0022e18c oart!Ordinal655+0x874
0022e12c 54793cbb 0022e3a4 094c4380 0022e18c oart!Ordinal655+0x182
0022e1c0 546bf722 0022e3a4 094c4380 00000000 oart!Ordinal5891+0xad1
0022e200 5474987d 0022e3a4 0d4f7f34 0022e2ec oart!Ordinal3910+0xfd6
0022e214 546bf6b4 0022e3a4 b93ad771 0d4f7f34 oart!Ordinal10880+0x98
0022e258 546beea2 1c0e82b0 b93ad1a5 0d2bce4c oart!Ordinal3910+0xf68
0022e48c 546be7e4 0022e968 0022ed6c 00000002 oart!Ordinal3910+0x756
0022e550 546be4d3 0d2bce48 0022e964 09661440 oart!Ordinal3910+0x98
0022e574 546be440 0022e968 00000002 0022e9b8 oart!Ordinal8924+0xaf
0022e598 546be3aa 0022e968 00000002 0022e9b8 oart!Ordinal8924+0x1c
0022e728 546bc00d 0d83a888 00000000 00000000 oart!Ordinal5363+0x261
0022e784 5474c3c6 00000000 00000000 0d43e458 oart!Ordinal8822+0x20
0022e894 5474c224 0022e964 0022eaa0 00000000 oart!Ordinal5408+0x4f1
0022ea64 5474bff6 0d371f40 0022eaa0 00000000 oart!Ordinal5408+0x34f
0022eb28 54749818 0d371f40 0022ebac 0022eb4c oart!Ordinal5408+0x121
0022eb5c 5473ea78 0d371f40 0022ebac 00000000 oart!Ordinal10880+0x33
0022ed0c 54741fc8 0d371f40 0022ef28 00000000 oart!Ordinal1852+0x241
0022ed44 547425e5 0d371f40 0022ef28 00000000 oart!Ordinal2425+0x5ea
0022ef6c 54743796 0d1a15a0 00000000 0022f34c oart!Ordinal2425+0xc07
0022f0e4 54741d5c 0022f1f0 0473c1ab 3feab68a oart!Ordinal2081+0x292
0022f210 547439d6 0022f2d0 0473c1ab 3feab68a oart!Ordinal2425+0x37e
0022f268 554ecfaa 0022f2d0 0473c1ab 3feab68a oart!Ordinal8518+0xb6
0022f380 554edbd7 b93ac69d 0d3d99bc 0d3d9998 ppcore!PPMain+0x74eff
0022f3b4 554edba9 55497d99 0022f3df b93ac6d9 ppcore!PPMain+0x75b2c
0022f3f0 55497d5a 0022f428 0fabe376 0d3d99b8 ppcore!PPMain+0x75afe
0022f3f8 0fabe376 0d3d99b8 0d184d04 0fabe203 ppcore!PPMain+0x1fcaf
0022f428 0fabd28d 003f9a38 003f7e00 003ff518 mso!Ordinal8295+0x22d
0022f440 0fbd483a 003f9a38 01a81a32 003ff608 mso!Ordinal4996+0x12b
0022f478 0fbd476e 00000001 003ff608 003f7d5c mso!Ordinal3599+0xaf
0022f4d0 0fbce774 003f7d5c 00000000 003f7e9c mso!Ordinal9018+0x334
0022f4ec 0fbcc03c 00000000 0022f55c 00000100 mso!Ordinal8480+0x29d
0022f500 0fbcbf08 003f7e9c 0022f528 5549d3f5 mso!Ordinal4921+0x4c1
0022f50c 5549d3f5 03cd02a0 ffffffff 5549d38b mso!Ordinal4921+0x38d
0022f528 5549d26c 0022f55c 00000001 00000000 ppcore!PPMain+0x2534a
0022f540 5549d238 0022f55c b93ac2b5 01033034 ppcore!PPMain+0x251c1
0022f79c 554780fc 0022f7b8 b93acd25 01033034 ppcore!PPMain+0x2518d
0022f80c 01031572 00312c8c 0022f8ac 0103154a ppcore!PPMain+0x51
0022f818 0103154a 01030000 00000000 00312c8c POWERPNT+0x1572
0022f8ac 76a5338a fffde000 0022f8f8 771f9902 POWERPNT+0x154a
0022f8b8 771f9902 fffde000 64dc254a 00000000 kernel32!BaseThreadInitThunk+0xe
0022f8f8 771f98d5 010312bb fffde000 ffffffff ntdll!__RtlUserThreadStart+0x70
0022f910 00000000 010312bb fffde000 00000000 ntdll!_RtlUserThreadStart+0x1b
--- cut ---
The poc.emf file is attached.
The above analysis was performed using the gdiplus.dll file found in C:\Windows\winsxs\x86_microsoft.windows.gdiplus_6595b64144ccf1df_1.1.7601.23407_none_5c02a2f5a011f9be\GdiPlus.dll on a fully patched Windows 7 64-bit operating system (md5sum c861ee277cd4e2d914740000161956ef).
Proof of Concept:
https://gitlab.com/exploit-database/exploitdb-bin-sploits/-/raw/main/bin-sploits/40257.zip
Products Mentioned
Configuraton 0
Microsoft>>Live_meeting >> Version 2007
Microsoft>>Lync >> Version 2010
Microsoft>>Lync >> Version 2010
Microsoft>>Lync >> Version 2013
Microsoft>>Office >> Version 2007
Microsoft>>Office >> Version 2010
Microsoft>>Skype_for_business >> Version 2016
Microsoft>>Word_viewer >> Version *
Microsoft>>Windows_7 >> Version *
Microsoft>>Windows_server_2008 >> Version *
Microsoft>>Windows_server_2008 >> Version r2
Microsoft>>Windows_vista >> Version *
References