{"id":15130147,"url":"https://github.com/paradigmxyz/paradigm-ctf-infrastructure","last_synced_at":"2025-06-19T05:40:49.231Z","repository":{"id":56815446,"uuid":"525601483","full_name":"paradigmxyz/paradigm-ctf-infrastructure","owner":"paradigmxyz","description":"Public infra related to hosting Paradigm CTF","archived":false,"fork":false,"pushed_at":"2024-03-24T08:26:34.000Z","size":170,"stargazers_count":110,"open_issues_count":3,"forks_count":13,"subscribers_count":4,"default_branch":"main","last_synced_at":"2025-03-28T23:11:12.129Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":null,"language":"Solidity","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":null,"status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/paradigmxyz.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":null,"code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2022-08-17T01:43:35.000Z","updated_at":"2025-03-07T18:28:20.000Z","dependencies_parsed_at":"2024-11-09T07:51:34.202Z","dependency_job_id":null,"html_url":"https://github.com/paradigmxyz/paradigm-ctf-infrastructure","commit_stats":null,"previous_names":[],"tags_count":0,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/paradigmxyz%2Fparadigm-ctf-infrastructure","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/paradigmxyz%2Fparadigm-ctf-infrastructure/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/paradigmxyz%2Fparadigm-ctf-infrastructure/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/paradigmxyz%2Fparadigm-ctf-infrastructure/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/paradigmxyz","download_url":"https://codeload.github.com/paradigmxyz/paradigm-ctf-infrastructure/tar.gz/refs/heads/main","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":249119788,"owners_count":21215812,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":[],"created_at":"2024-09-26T02:40:08.580Z","updated_at":"2025-04-15T17:37:25.198Z","avatar_url":"https://github.com/paradigmxyz.png","language":"Solidity","funding_links":[],"categories":["4. Learning Resources"],"sub_categories":["zkHACK/CTF/Puzzles"],"readme":"# Paradigm CTF Infra\n\nThis repository contains all the files used to host [Paradigm CTF](https://ctf.paradigm.xyz). For help and support, join the [Discord](https://discord.gg/J2PwXQG7qR).\n\n## Getting Started\n\nTo run the CTF infrastructure locally, simply run the following commands:\n\n```bash\ncd paradigmctf.py\ndocker compose up\n```\n\nTo run the CTF infrastructure in kCTF, you'll need to do the following:\n\n```bash\n# create the cluster if it doesn't exist\nkctf cluster create --type kind local-cluster\n\n# build the image\n(cd paradigmctf.py; docker build gcr.io/paradigmxyz/infra/paradigmctf.py:latest)\n\n# push the image to kind\nkind load docker-image --name \"${CLUSTER_NAME}\" \"gcr.io/paradigmxyz/infra/paradigmctf.py:latest\"\n\n# create all the resources\nkubectl apply -f kubernetes/ctf-server.yaml\n\n# port forward the anvil proxy for local access\nkubectl port-forward service/anvil-proxy 8545:8545 \u0026\n```\n\nNow you'll be able to build and test challenges in kCTF:\n```bash\n# start the challenge\nkctf chal start\n\n# port forward the challenge\nkctf chal debug port-forward --port 1337 --local-port 1337 \u0026\n\n# connect to the challenge\nnc 127.0.0.1 1337\n```\n\n## Images\n\nParadigm CTF is hosted using [kCTF](https://google.github.io/kctf/), a Kubernetes-based CTF platform. Follow the kCTF setup instructions to get a local cluster running on your computer.\n\n### kctf-challenge\nThe [kctf-challenge](/kctf-challenge/) image acts as a standard image on top of the kCTF base image. It's optional, not required, but provides the following features:\n- Adds the `/bin/kctf_persist_env` and `/bin/kctf_restore_env` scripts for use with `kctf_drop_privs`, which resets all environment variables (this might be removed if a better way of passing configuration variables is identified)\n- Adds a common `nsjail.cfg` for use with Anvil. The usefulness of running the Anvil server inside nsjail is debatable, as a lot of security features need to be disabled (timeouts, resource limits, etc). The file is also poorly-named, and may be changed in the future\n\n### paradigmctf.py\nThe [paradigmctf.py](/paradigmctf.py/) image acts as the base image for all challenges. It provides the following features:\n- Installs the `ctf_launchers`, `ctf_solvers`, and `ctf_server` libraries. These can be used to orchestrate CTF challenge instances.\n\n## Libraries\n\n### forge-ctf\nThe [forge-ctf](/forge-ctf/) library provides two Forge scripts which can be used to deploy and solve challenges. They are intended to be used with the `eth_launchers` package.\n\nThe `CTFDeployment` script can be overridden to implement the `deploy(address system, address player) internal returns (address challenge)` function. It defaults to using the `test [...] test junk` mnemonic, but will read from the `MNEMONIC` environment variable. It writes the address that the challenge was deployed at to `/tmp/deploy.txt`, or the value of `OUTPUT_FILE`.\n\nThe `CTFSolver` script can be overriden to implement the `solve(address challenge, address player)` function. The challenge address must be specified as the `CHALLENGE` environment variable. The player private key defaults to the first key generated from the `test [...] junk` mnemonic, but can be overridden with `PLAYER`.\n\n## Templates\n\nTemplates are provided for you to quickly get started with creating challenges of your own. To use them, copy the [templates](/templates/) into `kctf/challenge-templates`. Then, you will be able to use `kctf chal create --template eth-pwn`.\n\n## TODO\nHuff support is pretty bad, needs the following changes upstream:\n- https://github.com/huff-language/foundry-huff/issues/47\n- Needs to support broadcasting from specific address\n- Needs to stop using hexdump to generate some random bytes\n\nKubernetes support is not complete yet\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fparadigmxyz%2Fparadigm-ctf-infrastructure","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fparadigmxyz%2Fparadigm-ctf-infrastructure","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fparadigmxyz%2Fparadigm-ctf-infrastructure/lists"}