# Memory Corruption

### Introduction

An SGX program may still suffer from traditional software attacks if the program binary contains vulnerabilities. One type of vulnerabilities is memory corruption that enables control-flow hijacking attacks such as return-oriented programming (ROP) and return-to-libc attacks. This section demonstrates an ROP attack against an enclave and our mitigation (i.e., fine-grained ASLR) against the attack.&#x20;

### Dark ROP

This video shows how the Dark ROP attack detects `memcpy()` and copy the entire memory contents of an enclave to the outside.

{% embed url="<https://youtu.be/kixVRC-SHQE>" %}

### SGX-Shield

This video demonstrates the effectiveness of fine-grained ASLR support of SGX-Shield.

{% embed url="<https://youtu.be/0aSilQ5SR58>" %}


---

# Agent Instructions: Querying This Documentation

If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter:

```
GET https://sgx101.gitbook.io/sgx101/sgx-security/memory-corruption.md?ask=<question>
```

The question should be specific, self-contained, and written in natural language.
The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
