.xlsx
file.
Excel.exe
process was using the CPU and almost all the available RAM intensively.High
priority to Excel.exe
and waiting about ten minutes, Excel.exe
was able to complete the save operation by saving the work done by the student in an .xlsx
file (but the process was still using the CPU and almost all the available RAM intensively 🤔)..xlsx
file; immediately Excel.exe
(I was using Microsoft Excel for Microsoft 365 MSO (Version 2202 Build 16.0.14931.20858) 64-bit) began to use the CPU and almost all the RAM memory intensively, causing a Denial of Service condition on the system and preventing me from checking the contents of the spreadsheet in a reasonable time..xlsx
file with LibreOffice, no heavy CPU\RAM usage has been reported, and I was able to check the contents of the spreadsheet without problems. This led me to think that the problem wasn't the .xlsx
file (eg corrupted file), but the way Excel represented its contents.Excel.exe
to use RAM and CPU so intensively, but I still had other exercises to check and things to do, so I decided to let it go.
.xlsx
file; I was curious about the exact cause of the problem..xlsx
file again and, looking closely, noticed that the first chart (shown on the left in this image) was visible, but the following image was shown in place of the second chart (shown on the right).
Excel.exe
process is using the CPU and almost all the available RAM intensively.Excel.exe
into a sort of infinite loop during its loading..xlsx
file is a zipped file and its format is an XML-based file format..xml
file..xml
file is stored in a precise folder, and all folders are zipped into an .xlsx
file..xml
files, just change the .xlsx
file extension to .zip
and unzip its content..xlsx
file, you should see this:
.xlsx
file content can be "Primary" or "Secondary"..xlsx
file, I suggest you read this article, from which I took the previous two images and summarized some concepts.xl\charts\chart2.xml
file.xl
folder contains the actual content of the student's .xlsx
file, charts
contains all the charts created by the student (and all their "secondary" contents, like colors and styles) and chart2.xml
is the file containing the chart settings we want to analyze.chart2.xml
one or more settings set by the student that trigger the Excel vulnerability. The idea to find these settings is as follows:
.xlsx
file (test.xlsx
) containing only a chart of the same type (scatter chart) and with the same values of the one created by the student, without changing its default settings.
chart2.xml
and the .xml
file containing the settings of the newly created chart (let's call it fakeChart.xml
).
fakeChart.xml
settings by adding one of those noted in step 2 (or a combination of them).
test.xlsx
file containing the fakeChart.xml
file created in step 3.test.zip
and change its extension to .xlsx
).
test.xlsx
file in Excel.
<c:valAx>
tags of the chart2.xml
file, and are as follows:<c:valAx>
<c:max val="1"/>
← first setting<c:delete val="1"/>
← second setting</c:valAx>
text.xlsx
file the vulnerability is no longer triggered, it means that the settings just reset are the ones that trigger it.
<c:valAx>
settings (and vice versa).chart2.xml
file:<c:valAx>
tags but the two settings can only be found within the second tag (indicated by the green arrow).<c:valAx>
tag specifies a value axis of the chart and chart2.xml
contains four because in a generic chart it's possible to have the following four value axes:
<c:valAx>
tags seem to be arranged in a precise order and the second tag (the one containing the two settings) is the one relating to the Primary Vertical value axis.<c:valAx>
tags:
<c:scaling>
sub-tag while the second (indicated by the purple arrow) directly within the <c:valAx>
tag:<c:scaling>
sub-tag contains additional axis settings which, in this case, are the orientation of the axis (<c:orientation>
tag) and its maximum value (<c:max>
tag).minMax
and this means that the axis values must be displayed from minimum to maximum (the opposite effect can be obtained by setting the value to maxMin
); the max value is set to 1
and this means that the maximum value of the axis must be 1
(so, as a consequence, the chart lines exceeding this value won't be shown).<c:delete>
tag means that the axis shall be deleted from the chart (that is, it won't be visible to the user).1
and delete the axis itself (make it invisible in the chart)..xlsx
files (each one with their own scatter chart), setting for each scatter chart different values of the <c:max>
and <c:delete>
tags (using the Excel User Interface), with the hope of being able to trigger the vulnerability.
<c:delete val="0"/>
) and see how the chart changed by setting its maximum value (I used 1
as a test) and leaving it unset (in this case its default value is used: Auto
).1
the <c:max val="1"/>
tag is written within the <c:scaling>
tag, otherwise it isn't written at all (this means that the <c:max .../>
tag can be found within the <c:scaling>
tag only if the user set a maximum value of the axis).CASE 2
the case in which the maximum value of the PVVA is set to 1
and CASE 1
the case in which its value is left unset (this is the default case used by Excel when the user creates a new chart; in this case Excel sets a maximum value that fits well with the values that are to be represented in the chart).CASE 1
, when the chart lines exceed the maximum value of the PVVA, Excel automatically changes its scale (and therefore also its maximum value) and draws new equidistant (horizontal) grid lines, so that all lines of the chart are entirely visible.CASE 2
, when the chart lines exceed the maximum value of the PVVA, the scale doesn't change, the (horizontal) grid lines remain equidistant and only the part of the chart that falls within its maximum value is displayed (therefore some lines of the chart aren't entirely visible).
<c:delete val="0"/>
) while, as we've seen previously, the vulnerability is triggered when it isn't (<c:delete val="1"/>
).<c:delete val="1"/>
), saved the file (forcing Excel to write the <c:delete val="1"/>
tag within the .xml
file related to the chart (chart1.xml
)) and changed the values of the chart, both in CASE 1
and in CASE 2
.CASE 1
nothing unexpected has happened: since I deleted the PVVA, Excel, during the creation of the chart, has referred to the Secondary Vertical value axis (which, for simplicity, I'll call SVVA from now on) and, when the chart lines have exceeded its maximum value, Excel automatically changed its scale (because, by default, the SVVA has the maximum value set to Auto
) and drew new equidistant (horizontal) grid lines, so that all lines of the chart were entirely visible.CASE 2
however, something unexpected happened!CASE 1
since I deleted the PVVA, therefore its maximum value (which is one of its many properties) should no longer be considered, but I was wrong.CASE 1
until it has to draw the (horizontal) grid lines: it draws too many lines!SVVA units | Grid lines drawn |
---|---|
1 | 10 |
1,2 | 12 |
2 | 20 |
2,5 | 25 |
3 | 30 |
3,5 | 35 |
... | ... |
n | 10*n |
CASE 2
:
CASE 2
), doesn't handle (horizontal) grid lines well, but this wasn't enough to trigger the vulnerability because, except this, it continued to work properly. Can we say: "close but not cigar"? 🚭
<c:max val="1"/>
):Grid lines number | Working set | Non-response time | Prolonged DoS |
---|---|---|---|
1 000 000 | 1.2 GB | ∼1 seconds | NO |
5 000 000 | 5.1 GB | ∼6 seconds | NO |
5 500 000 | 5.25 GB | ∼6.5 seconds | NO |
6 500 000 | 7.4 GB | ∼9 seconds | NO |
7 000 000 | 8.82 GB | ∼11.5 seconds | NO |
10 000 000 | 10.95 GB | ∼17 seconds | NO |
UNKNOWN THRESHOLD | EXHAUSTED | ∞ | YES |
99 999 999 999 | EXHAUSTED | ∞ | YES |
.xlsx
file which, once opened, exploits the vulnerability as I just described, bringing the system into a DoS condition.99999999999
) and saving the file. The problem is that, as soon as we set that value, the vulnerability is immediately triggered, Excel stops responding and we can't save the file because we will no longer be able to interact with its graphical interface..xlsx
file, a chart as shown here, save the file and directly edit the .xml
file related to the chart (chart1.xml
) and the spreadsheet (sheet1.xml
).<c:delete val="1"/>
and <c:max val="1"/>
in ...\xl\charts\chart1.xml
, while to set a high value (99999999999
in my case) in cell B2 we must insert the tag <c r="B2"><v>99999999999</v></c>
in ...\xl\worksheets\sheet1.xml
..xlsx
. Opening the file, the vulnerability will be triggered immediately.
Thread Create
) to which delegate the task (which also consists, among other things, of drawing the grid lines), in order to be ready to manage any user interactions with the spreadsheet.Ordinal43+0x...
, oart.dll+0x...
and GetExportedInterface+0x...
.Ordinal43+0x...
is already loaded within the EXCEL.EXE
module while oart.dll+0x...
and GetExportedInterface+0x...
functions are implemented, respectively, within the oart.dll
and chart.dll
modules (which, consequently, must be loaded into memory).oart.dll
(Microsoft OfficeArt) provides graphics features that are shared between Office apps, while chart.dll
(Microsoft Office Charting) exports many functions that provide support for interacting with charts and graphs, and this is just what the thread needs.Thread Exit
) and the user can see the chart in the spreadsheet.
Ordinal43+0xb330
, increases more and more its number of Delta Cycles and the CPU \ RAM usage.GetExportedInterface+0x...
, ntoskrnl.exe
calls functions KeSynchronizeExecution
, KeWaitForSingleObject
and KeAreAllApcsDisabled
.ntoskrnl.exe
synchronizes the thread's task with the Interrupt Service Routine (KeSynchronizeExecution), puts it in a waiting state until it reaches the time limit or the dispatcher reactivates it (KeWaitForSingleObject), checks if it's inside a guarded region (KeAreAllApcsDisabled), puts it back in a waiting state and resynchronizes it with the Interrupt Service Routine.
h
of the chart is 1, the thickness of the lines is negligible and we suppose to add the new lines between the first and last line to simplify calculations then, to draw n
equidistant grid lines we must distance them by a distance d
equal to h\(n+1)
from each other.SVVA units | Grid lines number (n) | Grid lines distance (d) |
---|---|---|
1 | 10 | 0.090909090 |
10 | 100 | 0,009900990 |
100 | 1000 | 0,000999000 |
1000 | 10 000 | 0,000099990 |
10 000 | 100 000 | 0,000009999 |
100 000 | 1 000 000 | 0.000000999 |
1 000 000 | 10 000 000 | 0.000000099 |
... | ... | ... |
99 000 000 | 990 000 000 | 0,000000001 |
luca.barile.research@gmail.com
; I'll add your answer to this paragraph ASAP.
.xml
file related to the chart (chart1.xml
) and creating a specially crafted .xlsx
file, as shown here.
Auto
).
.xml
file related to a generic chart, it must check that none of the chart's axes is not visible (<c:delete val="1"/>
) and with a maximum value set (<c:max val="some_number"/>
) at the same time.Auto
). To do this, it must delete the <c:max val="some_number"/>
tag from the .xml
file (if Excel doesn't find that tag among the various tags that define the properties of an axis, it sets the maximum value of the axis to Auto
).
.xlsx
file which, once opened, triggers the DoS condition on the system.
.xlsx
file to exploit it.
VULN-082616
) to MSRC to know if they're interested in a Microsoft Excel DoS vulnerability.New
76656
) asking me to keep the details of this case confidential during their investigation.New
➞ Review/Repro
.
Review/Repro
➞ Develop
.
Develop
➞ Pre-Release
.
Pre-Release
➞ Release
.
Release
➞ Complete
.
.xlsx
files, so analyzing Excel file parsing process could be a good starting point to discover new vulnerabilities.