text
stringlengths
0
1.99k
pages to the same physical page and that gave us, zero, nada hits,
confirming that this wasn’t leaking due to a stale TLB entry. After tons of
such tests, we realized we don’t actually know the microarchitectural
structure where the is leak coming from, so we are started calling it the
“eviction buffer”.
To leak the stale data, there must be a full physical address tag hit on
the eviction buffer. We wrote a PoC for this behavior by tracking the
physical memory address throughout the tests and then matching the secret
addresses with their respective tags.
To get the physical address, we used PTEditor built-in function
ptedit_pte_get_pfn, which returns the – as you might expect – the
page-frame number.
--[ 3 - Sparkle PoC Recipe
If you want to see your Zen4 platform sparkling for yourself:
1. Create two processes – one is the victim, one is the attacker.
a. The victim allocates a memory buffer and writes a secret value to
it.
Then, the victim overwrites the secret in memory, frees the allocated
buffer, and exits (yeap, the process doesn’t need to be running)!
b. The attacker allocates memory in order to reclaim the same physical
pages previously used by the victim to write the secret. You can choose
your own version for this – allocating tons of memory is legit :)
2. The attacker marks the reclaimed memory as WC and flushes the TLB
(making sure that the TLB entry is up-to-date).
3. The attacker reads the memory and gets the secret – all sparkling!
Serving options:
- Overwrite the secret in the victim and terminate the victim
process:
The attacker is able to leak the secret even if the secret value
was previously overwritten architecturally.
- Run the victim and the attacker processes in the same core (sibling
threads), in any neighboring core (in the same CPU), or leak between
host and guest virtual machine.
- Try it out mixing and matching domains, e.g., VM host and guest
--[ 4 - Reading the Funny Manual
It is important to note before we let you go that the __AMD64 Architecture
Programmer's Manual Volume 2: System Programming__ (https://www.amd.com/
system/files/TechDocs/24593.pdf) actually documents that we should not play
and switch between cache policies of a specific physical page, quoting:
---------------------------------------------------------------------------
7.8.7 Changing Memory Type
A physical page should not have differing cacheability types assigned to it
through different virtual mappings; they should be either all of a
cacheable type (WB, WT, WP) or all of a non-cacheable type (UC, WC).
Otherwise, this may result in a loss of cache coherency, leading to stale
data and unpredictable behavior.
---------------------------------------------------------------------------
So, please you all behave, and follow the manual – otherwise, there will be
sparkles.
--[ 6 - References
[1] Intel Corp. (2021-03-11). "Microarchitectural Data Sampling."
[2] Minkin, Marina; Moghimi, Daniel; Lipp, Moritz; Schwarz, Michael; Van
Bulck, Jo; Genkin, Daniel; Gruss, Daniel; Piessens, Frank; Sunar, Berk;
Yarom, Yuval (2019-05-14). "Fallout: Reading Kernel Writes From User Space"
[3] Schwarz, Michael; Lipp, Moritz; Moghimi, Daniel; Van Bulck, Jo;
Stecklina, Julian; Prescher, Thomas; Gruss, Daniel (2019-05-14).
"ZombieLoad: Cross-Privilege-Boundary Data Sampling"
[4] van Schaik, Stephan; Milburn, Alyssa; Österlund, Sebastian; Frigo,
Pietro; Maisuradze, Giorgi; Razavi, Kaveh; Bos, Herbert; Giuffrida,
Cristiano (2019-05-14). "RIDL: Rogue In-Flight Data Load"
[5] Michael Schwarz. PTEditor. https://github.com/misc0110/PTEditor
|=-----------------------------------------------------------------------=|
|=------------=[ 2 - Another use for the EICAR test file ]=--------------=|
|=-----------------------------------------------------------------------=|
|=---------------------=[ Peter Ferrie (qkumba) ]=-----------------------=|
|=-----------------------------------------------------------------------=|
X5O!P%@AP[4\PZX54(P^)7CC)7}$EICAR-STANDARD-ANTIVIRUS-TEST-FILE!$H+H*
The EICAR test string, right?
68 bytes
CRC32 6851cf3c
MD5 44d88612fea8a8f36de82e1278abb02f
SHA256 275a021bbfb6489e54d471899f7db9d1663fc695ec2fe2a2c4538aabf651fd0f
Right? Right??
No.