commit 6235dd21f3e73412eea2ba2afafd8be963141b80 Author: Valentyn Faychuk Date: Wed Jan 8 21:10:00 2025 +0200 first commit with hacker challenge diff --git a/.gitignore b/.gitignore new file mode 100644 index 0000000..7585238 --- /dev/null +++ b/.gitignore @@ -0,0 +1 @@ +book diff --git a/book.toml b/book.toml new file mode 100644 index 0000000..a153fdc --- /dev/null +++ b/book.toml @@ -0,0 +1,34 @@ +[book] +authors = ["Valentyn Faychuk"] +language = "en" +multilingual = false +src = "src" +title = "DeTEE Public Documentation" + +[output.html] +smart-punctuation = true +mathjax-support = true +site-url = "https://detee.ltd" +git-repository-url = "https://gitea.detee.cloud/general/public-docs" +#edit-url-template = "https://github.com/rust-lang/mdBook/edit/master/guide/{path}" + +[output.html.playground] +runnable = false +editable = true +line-numbers = true + +#[output.html.code.hidelines] +#python = "~" + +[output.html.search] +limit-results = 20 +use-boolean-and = true +boost-title = 2 +boost-hierarchy = 2 +boost-paragraph = 1 +expand = true +heading-split-level = 2 + +#[output.html.redirect] +#"/format/config.html" = "configuration/index.html" + diff --git a/src/404.md b/src/404.md new file mode 100644 index 0000000..61b0af3 --- /dev/null +++ b/src/404.md @@ -0,0 +1,3 @@ +# Document not found (404) + +This URL is invalid, sorry. Try the search instead! diff --git a/src/README.md b/src/README.md new file mode 100644 index 0000000..1816559 --- /dev/null +++ b/src/README.md @@ -0,0 +1,22 @@ +# DeTEE logo  DeTEE + +--- + +Welcome to the DeTEE's documentation. DeTEE is a decentralized confidential cloud. It is designed to make deploying Confidential VMs and Containers quick and easy, with the ability to scale up to the complex setups. + +Get started with [Installation](./todo.md) and then get an overview with the [Quickstart](./todo.md).\ +There is also a [Hacker Challenge](./hacker_challenge/README.md) if you want to try breaking DeTEE for a reward!\ +DeTEE depends on the [Occlum](https://occlum.readthedocs.io) library for working with Intel SGX, and the [Rust sev crate](https://crates.io/crates/sev) for working with AMD SEV. + +
+ +--- + +The documentation is under active development.\ +If you see any issue, feel free to contact . +- [x] Prepare the first version of docs +- [x] Add Hacker Challenge +- [ ] Add installation steps +- [ ] Add contributors +- [ ] Add license +- [ ] ... diff --git a/src/SUMMARY.md b/src/SUMMARY.md new file mode 100644 index 0000000..54efa84 --- /dev/null +++ b/src/SUMMARY.md @@ -0,0 +1,35 @@ +# Summary + +[Introduction](./README.md) + +--- + +# User Guide + +- [Installation](./todo.md) +- [Become a Node]() +- [Buy DTE Token]() + +# Reference Guide + +- [Provider Nodes]() + - [detee-daemon]() +- [Brain Nodes]() + - [brain-node]() +- [Users]() + - [detee-cli]() + +--- + +# Security + +- [Hacker Challenge](./hacker_challenge/README.md) + - [Prerequisites](./hacker_challenge/prerequisites.md) + - [Quick Start](./hacker_challenge/quick_start.md) + - [Hacking](./hacker_challenge/hacking.md) + - [Network](./hacker_challenge/network.md) + - [Issues](./hacker_challenge/known_issues.md) + +--- + +[Contributors](./misc/contributors.md) diff --git a/src/hacker_challenge/README.md b/src/hacker_challenge/README.md new file mode 100644 index 0000000..bb3e3bc --- /dev/null +++ b/src/hacker_challenge/README.md @@ -0,0 +1,11 @@ +# Hacker Challenge + +--- + +Hack the wallet 2yKf...Yxpb to unlock the DeTEE prize! Wallet keys are secured inside every node of the Hacker Challenge cluster, which anybody can join! No rules - hack the node, seize the keys, win the prize! + +#### The main rules of the hacker challenge: +- Don't ever send to the hacker challenge wallet what you don't want to lose +- Before joining as a node, make sure your processor meets requirements +- Otherwise, no restrictions - anybody can participate +- Also no rules for hacking, you can even use a tank diff --git a/src/hacker_challenge/hacking.md b/src/hacker_challenge/hacking.md new file mode 100644 index 0000000..f7e4f14 --- /dev/null +++ b/src/hacker_challenge/hacking.md @@ -0,0 +1,22 @@ +# How it all works? + +This node is part of the DeTEE hacker-challenge, a decentralized wallet that mints the HCT Token. +The private key of the mint authority was generated within the network. The challenge is easy: +Hack the network to get the private key, and all the SOL is yours. We also offer other rewards, including: +- a unique NFT +- token rewards at after release of the DeTEE token +- a seat on the Advisory Board of DeTEE +- possible employment at DeTEE + +The mint address of the token is: TOKEN_ADDRESS +The mint authority is: MINT_AUTHORITY + +In order to mint, the mint authority will need some SOL. Before sending SOL, take into consideration that +DeTEE REPRESENTATIVES DON'T KNOW HOW TO GET THE SOL OUT OF THE NETWORK! + +You can make following requests: +- `/nodes ` <- information about nodes and counters of network activity +- `/mint?address=
` <- mint HCT tokens to the address; the wallet needs SOL for this operation + +If you were able to get the SOL out of the wallet, please contact , +The code of the challenge can be found at https://gitea.detee.cloud/general/hacker-challenge diff --git a/src/hacker_challenge/how_it_works.md b/src/hacker_challenge/how_it_works.md new file mode 100644 index 0000000..4ed8307 --- /dev/null +++ b/src/hacker_challenge/how_it_works.md @@ -0,0 +1 @@ +# How it works? diff --git a/src/hacker_challenge/known_issues.md b/src/hacker_challenge/known_issues.md new file mode 100644 index 0000000..1a66527 --- /dev/null +++ b/src/hacker_challenge/known_issues.md @@ -0,0 +1,16 @@ +# Known issues + +1. If you create a new node as a root and it will create the private key and save it + to the disk, it will remain sealed and when the node will restart and try to join + the rest of the network, it will still use the private key from the disk for + minting and sharing. +2. If you run the hacker challenge on the Out Of Life processors you may have a + privilege to run certain attacks, for instance check [this + article](https://x.com/PratyushRT/status/1828183761055330373). +3. The challenge is compiled using the HW mode, not HYPER so it may not work on + some cloud providers, like Azure Intel SGX VMs (needs more testing). +4. The performance and stability of the challenge is not at its theoretical peak as + the challenge was done mostly as a poc and was not meant to be infinitely scalable + or very performant. +5. The challenge is not mutable once deployed, which means that it will remain + secure for as long as the community will not find a new vulnerability in SGX. diff --git a/src/hacker_challenge/network.md b/src/hacker_challenge/network.md new file mode 100644 index 0000000..5ddc1d7 --- /dev/null +++ b/src/hacker_challenge/network.md @@ -0,0 +1,11 @@ +# More about the network + +Each node in the network runs inside an enclave. The enclave is a program that operates in a trusted execution environment (TEE). Memory of programs within the enclave can not be inspected from outside the enclave. Programs within the enclave have access to sources of entropy that cannot be predicted from outside. Programs can also access reproducible secrets that they can use to seal[^1] persistent data. Each enclave has a certain set of measurements, consisting of all the data required for the program to run (instructions, configuration, etc.). A running program can generate a quote that can be used to verify the measurements and legitimacy of the hardware it's running on. + +Assuming there are no vulnerabilities in any of the mentioned hardware features, and our node implementation has none either, it should be practically impossible to steal the SOL from the network wallet because: +- wallet key is generated with the enclave's source of entropy +- nobody can inspect the memory that contains the key +- nodes verify the quote of each peer and refuse connections if quote measurements don't match their own +- node seals[^1] all persistent data saved to disk with the enclave's key + +[^1]: uses symmetric encryption to encrypt some data before exposing it to untrusted environment to later recover the data by decrypting diff --git a/src/hacker_challenge/prerequisites.md b/src/hacker_challenge/prerequisites.md new file mode 100644 index 0000000..e80fd80 --- /dev/null +++ b/src/hacker_challenge/prerequisites.md @@ -0,0 +1,13 @@ +# Prerequisites + +For running the Hacker Challenge you need a VM with Intel processor that supports SGX1/2, check [supported processors](https://www.intel.com/content/www/us/en/architecture-and-technology/software-guard-extensions-processors.html). You may also rent a VM, see [RedSwitches](redswitches.com) or [Hetzner](hetzner.com). Public IP is not mandatory to participate. + +Make sure you enabled SGX in BIOS. Just do `cpuid | grep -i sgx` to see if SGX is enabled. +Make sure you also have kernel above v5.13 to get a built-in SGX DCAP driver. +Final step is to add the symlinks for the sgx devices. + +```bash +sudo mkdir -p /dev/sgx +sudo ln -sf ../sgx_enclave /dev/sgx/enclave +sudo ln -sf ../sgx_provision /dev/sgx/provision +``` diff --git a/src/hacker_challenge/quick_start.md b/src/hacker_challenge/quick_start.md new file mode 100644 index 0000000..f6ff2a4 --- /dev/null +++ b/src/hacker_challenge/quick_start.md @@ -0,0 +1,17 @@ +# Quick Start + +Hacker challenge works as a cluster that anybody can join. +To join a cluster you need to run the DeTEE Hacker Challenge node (for simplicity we call it dthc): + +```bash +docker run --device /dev/sgx/enclave --device /dev/sgx/provision --env INIT_NODES="212.95.45.139 46.165.199.12 184.107.183.210" -v /tmp/dthc:/challenge/main -p 80:31372 -p 31373:31373 -d --name dthc detee/hacker-challenge:latest +``` + +Note. +- devices are mandatory to give node the access to the SGX driver +- `INIT_NODES` are current nodes (we update them) so that your node can download Solana keys from cluster +- in the /tmp/dthc you will find the file where the node writes Solana keys, it's called `TRY_TO_HACK_THIS` +- port 31373 is needed if you have a public IP and want other nodes to connect to you +- port 80 is the web interface of your node, it has `/nodes`, `/metrics` and `/mint
` endpoints + +After your node has started, feel free to start exploring logs in `docker logs ` and /tmp/dthc/logs diff --git a/src/img/cross.svg b/src/img/cross.svg new file mode 100644 index 0000000..36dba84 --- /dev/null +++ b/src/img/cross.svg @@ -0,0 +1,9 @@ + + + + + + + + + \ No newline at end of file diff --git a/src/img/logo.svg b/src/img/logo.svg new file mode 100644 index 0000000..426a43c --- /dev/null +++ b/src/img/logo.svg @@ -0,0 +1,22 @@ + + + + + + + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/src/misc/contributors.md b/src/misc/contributors.md new file mode 100644 index 0000000..320b77d --- /dev/null +++ b/src/misc/contributors.md @@ -0,0 +1,10 @@ +# Contributors + +Here is a list of the contributors who have helped improving DeTEE. Big +shout-out to them! + +- Gheorghe Ungureanu +- Valentyn Faychuk +- Noor Mohammed B +- Ramil Algayev +- Jakub Doka diff --git a/src/todo.md b/src/todo.md new file mode 100644 index 0000000..cef0108 --- /dev/null +++ b/src/todo.md @@ -0,0 +1,3 @@ +# The Page is under development 🫡 + +Feel free to contact us at or