Skip to content
KitploitKITPLOIT
ToolsBlog
Submit
ToolsBlog
Submit

Hacking, PenTest, and Cybersecurity Tools for Your Security Arsenal!

Kitploit is a directory of hacking, cybersecurity, and pentesting tools. Discover the latest project updates to find vulnerabilities, analyze systems, automate testing, and strengthen your security.

··Feeds·Contact·Privacy·© 2026 Kitploit

Tool Directory

Categories

View all categories
Loading categories
spectre-attack-demo — Example of using revealed "Spectre" exploit (CVE-2017-5753 and CVE-2017-5715) | Kitploit
Tools/GitHubGitHub/pedrolucasoliva/spectre-attack-demo
Vulnerability AnalysisExploitationCryptographyHardware SecurityLearning & EducationBinary Exploitation
GitHubpedrolucasoliva/spectre-attack-demo

spectre-attack-demo

Example of using revealed "Spectre" exploit (CVE-2017-5753 and CVE-2017-5715)

View Repository
1118 years agoNot yet reviewed

Most Popular

View all →

Discover the most used tools by our community.

Explore all tools

Browse our collection of tools

View all tools →
Share

Spectre Attack Example

Example of using revealed "Spectre" exploit from 2 Jan 2018 (CVE-2017-5753 and CVE-2017-5715)

Spectre breaks the isolation between different applications. It allows an attacker to trick error-free programs, which follow best practices, into leaking their secrets. In fact, the safety checks of said best practices actually increase the attack surface and may make applications more susceptible to Spectre.

  • Spectre paper - Spectre paper and source of code

Language

C, uses libs:

  • stdio.h
  • stdlib.h
  • stdint.h
  • intrin.h - for rdtscp and clflush

What's example do?

We're putting text "The Magic Words are Squeamish Ossifrage." in memory and then we're trying to read it using exploit. If system is vulnerable, you'll see same text in output, read from memory.


In this code, if the compiled instructions in victim_function() were executed in strict program order, the function would only read from array1[0..15] since array1 size = 16. However, when executed speculatively, out-of-bounds reads are possible. The readMemoryByte() function makes several training calls to to make the branch predictor expect valid values for x, then calls with an out-of-bounds x. The conditional branch mispredicts, and the ensuing speculative execution reads a secret byte using the out-of-bounds x. The speculative code then reads from , leaking the value of into the cache state. To complete the attack, a simple flush+probe is used to identify which cache line in was loaded, revealing the memory contents. The attack is repeated several times, so even if the target byte was initially uncached, the first iteration will bring it into the cache.

victim_function()
array2[array1[x] * 512]
array1[x]
array2

The unoptimized code reads approximately 10KB/second on an i7 Surface Pro 3.

Sources

  • Spectre exploits info
  • CVE-2017-5753 - Variant 1: bounds check bypass
  • CVE-2017-5715 - Variant 2: branch target injection
  • Intel affected CPUs list
Download Tool