{"id":13742196,"url":"https://github.com/cleanunicorn/karl","last_synced_at":"2026-01-12T07:37:22.483Z","repository":{"id":38784022,"uuid":"158328415","full_name":"cleanunicorn/karl","owner":"cleanunicorn","description":"Monitor smart contracts deployed on blockchain and test against vulnerabilities with Mythril. It was presented at DEFCON 2019.","archived":false,"fork":false,"pushed_at":"2025-12-15T19:15:47.000Z","size":4505,"stargazers_count":316,"open_issues_count":37,"forks_count":77,"subscribers_count":12,"default_branch":"master","last_synced_at":"2025-12-19T02:56:19.015Z","etag":null,"topics":["blockchain","defcon","defcon27","ethereum","security","smt","symbolic-execution"],"latest_commit_sha":null,"homepage":"","language":"Python","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/cleanunicorn.png","metadata":{"files":{"readme":"Readme.md","changelog":null,"contributing":null,"funding":null,"license":"License","code_of_conduct":"CODE_OF_CONDUCT.md","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,"zenodo":null,"notice":null,"maintainers":null,"copyright":null,"agents":null,"dco":null,"cla":null}},"created_at":"2018-11-20T03:57:28.000Z","updated_at":"2025-11-05T08:25:00.000Z","dependencies_parsed_at":"2023-10-12T03:29:17.579Z","dependency_job_id":"bf3691fb-5af1-4657-84d8-bf5cbf9e745c","html_url":"https://github.com/cleanunicorn/karl","commit_stats":null,"previous_names":[],"tags_count":39,"template":false,"template_full_name":null,"purl":"pkg:github/cleanunicorn/karl","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/cleanunicorn%2Fkarl","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/cleanunicorn%2Fkarl/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/cleanunicorn%2Fkarl/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/cleanunicorn%2Fkarl/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/cleanunicorn","download_url":"https://codeload.github.com/cleanunicorn/karl/tar.gz/refs/heads/master","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/cleanunicorn%2Fkarl/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":286080680,"owners_count":28336598,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2026-01-12T06:09:07.588Z","status":"ssl_error","status_checked_at":"2026-01-12T06:05:18.301Z","response_time":98,"last_error":"SSL_connect returned=1 errno=0 peeraddr=140.82.121.5:443 state=error: unexpected eof while reading","robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":false,"can_crawl_api":true,"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":["blockchain","defcon","defcon27","ethereum","security","smt","symbolic-execution"],"created_at":"2024-08-03T05:00:19.512Z","updated_at":"2026-01-12T07:37:22.465Z","avatar_url":"https://github.com/cleanunicorn.png","language":"Python","funding_links":[],"categories":["Tools"],"sub_categories":[],"readme":"# Karl\n\n**Obsolete, not maintained anymore, don't install it, don't use it, you were warned!**\n\n[![License: MIT](https://img.shields.io/badge/License-MIT-blue.svg)](https://opensource.org/licenses/MIT)\n[![CircleCI](https://circleci.com/gh/cleanunicorn/karl/tree/master.svg?style=shield)](https://circleci.com/gh/cleanunicorn/karl)\n[![Codacy Badge](https://api.codacy.com/project/badge/Grade/53bb3ba0ed50447698e775edd397baa7)](https://www.codacy.com/app/lucadanielcostin/karl)\n[![PyPI](https://img.shields.io/pypi/v/karl.svg)](https://pypi.org/project/karl/)\n[![Code style: black](https://img.shields.io/badge/code%20style-black-000000.svg)](https://github.com/ambv/black)\n[![Maintainability Rating](https://sonarcloud.io/api/project_badges/measure?project=cleanunicorn_karl\u0026metric=sqale_rating)](https://sonarcloud.io/dashboard?id=cleanunicorn_karl)\n\nA monitor for smart contracts that checks for security vulnerabilities.\n\n![Karl Vreski](./static/karl-profile.jpg)\n\n## Video presentation\n\n[DefCon 27](https://www.youtube.com/watch?v=Qd9ubry-c_M)\n\n## Install\n\nGet latest version of Karl.\n\n```console\n$ pip install --user karl\n```\n\nInstall [Ganache](https://truffleframework.com/ganache) with [npm](https://www.npmjs.com/get-npm) if you want Karl to test the found vulnerabilities in a sandbox (`--sandbox=true`, disabled by default), to reduce false positives.\n\n```console\n$ npm i -g ganache-cli\n```\n\n### Description\nKarl will allow you to monitor a blockchain for vulnerable smart contracts that are being deployed.\n\nIt connects to the blockchain, monitors for new blocks and runs `mythril` for every new smart contract deployed.\n\nThe output can be displayed in the console, saved in files in a folder or POSTed to a URL.\n\nOutput can be:\n\n- **stdout** just posting the results to standard output\n- **folder** create a file for each vulnerable contract in a folder\n- **posturl** POST the results to an http endpoint\n\n### Help message\n\n```console\n$ karl --help\nusage: karl [-h] [--rpc https://mainnet.infura.io/v3/12312312312312312312312312312312] [--rpc-tls RPC_TLS] [--block NUMBER] [--output Can be one of: stdout, posturl, folder]\n            [--posturl POSTURL] [--folder-output FOLDER_OUTPUT] [--sandbox SANDBOX] [--timeout SECONDS] [--loop-bound LOOP_BOUND] [--tx-count NUMBER]\n            [--modules [MODULES [MODULES ...]]] [--onchain-storage ONCHAIN_STORAGE] [--verbose] [--version]\n\nSmart contract monitor using Mythril to find exploits\n\noptional arguments:\n  -h, --help            show this help message and exit\n  --version             show program's version number and exit\n\nRPC options:\n  --rpc https://mainnet.infura.io/v3/12312312312312312312312312312312\n                        Custom RPC settings (default: None)\n  --rpc-tls RPC_TLS     RPC connection over TLS (default: False)\n  --block NUMBER        Start from this block, otherwise start from latest (default: None)\n\nOutput:\n  --output Can be one of: stdout, posturl, folder\n                        Where to send results (default: stdout)\n  --posturl POSTURL     Send results to a RESTful url [when using `--output posturl`] (default: None)\n  --folder-output FOLDER_OUTPUT\n                        Save files to this folder [when using `--output folder`] (default: None)\n\nSandbox:\n  --sandbox SANDBOX     Test found transactions in a Ganache sandbox (default: False)\n\nScan options:\n  --timeout SECONDS     Scan timeout per contract (default: 600)\n  --loop-bound LOOP_BOUND\n                        Maximum number of loop iterations (default: 3)\n  --tx-count NUMBER     Maximum number of transactions (default: 3)\n  --modules [MODULES [MODULES ...]]\n                        Modules to use for scanning (default: ['ether_thief', 'suicide'])\n  --onchain-storage ONCHAIN_STORAGE\n                        Whether onchain access should be done or not (default: True)\n\nVerbosity:\n  --verbose, -v         Set verbose (default: 4)\n```\n\n## Examples\n\n### Running against the **mainnet**\n\n```console\n$ karl --rpc https://mainnet.infura.io/\nStdout initialized\nRunning\nScraping block 6745471\nScraping block 6745472\nScraping block 6745473\nAnalyzing 0xf8c065bB1DafC99eE5476a2b675FAC4a036a4B07\nScraping block 6745474\nAnalyzing 0xC9e044D76f211E84bA651b30BBA86758ca8017c7\nScraping block 6745475\nScraping block 6745476\nScraping block 6745477\nAnalyzing 0x19427b8FD32dfEc78393517Da416bC5C583E6065\n```\n\n### Running against **ganache** with **stdout** enabled\n\n```console\n$ karl --rpc http://localhost:8545 --output=stdout\nINFO:mythril.mythril:Using RPC settings: ('localhost', 8545, False)\nINFO:mythril.analysis.modules.suicide:Suicide module: Analyzing suicide instruction\nPOSSIBLE VULNERABILITY!\nInitial balance = 100000000000000000000, final balance = 100999999999999985722\n\nType = VulnerabilityType.KILL_AND_WITHDRAW\nDescription = Looks line anyone can kill this contract and steal its balance.\nTransactions = [{'from': '0x1dF62f291b2E969fB0849d99D9Ce41e2F137006e', 'to': '0x2F2B2FE9C08d39b1F1C22940a9850e2851F40f99', 'data': '0xcbf0b0c0bebebebebebebebebebebebe1dF62f291b2E969fB0849d99D9Ce41e2F137006e', 'value': 0}]\n```\n\n### Running against **ganache** with **posturl** enabled\n\n```console\n$ karl --rpc [ganache](http://localhost:8545) --output=posturl --posturl=http://localhost:8080\nPosturl initialized\nRunning\nScraping block 5\nAnalyzing 0x4b8e80acaE3F0db32e5d35925EfaA97D477dBb70\n```\n\nAnd it will send this to the listening service\n\n```console\n$ nc -l 8080\nPOST / HTTP/1.1\nAccept-Encoding: identity\nContent-Type: application/x-www-form-urlencoded\nContent-Length: 725\nHost: localhost:8080\nUser-Agent: Python-urllib/3.7\nConnection: close\n\n{\n    \"error\": null,\n    \"issues\": [{\n        \"address\": 722,\n        \"contract\": \"0x4b8e80acaE3F0db32e5d35925EfaA97D477dBb70\",\n        \"debug\": \"Transaction Sequence: {'1': {'calldata': '0x56885cd8', 'call_value': '0x0', 'caller': '0xaaaaaaaabbbbbbbbbcccccccddddddddeeeeeeee'}, '4': {'calldata': '0x6c343ffe', 'call_value': '0x0', 'caller': '0xaaaaaaaabbbbbbbbbcccccccddddddddeeeeeeee'}}\",\n        \"description\": \"Arbitrary senders other than the contract creator can withdraw ETH from the contract account without previously having sent an equivalent amount of ETH to it. This is likely to be a vulnerability.\",\n        \"function\": \"withdrawfunds()\",\n        \"max_gas_used\": 1749,\n        \"min_gas_used\": 1138,\n        \"swc-id\": \"105\",\n        \"title\": \"Ether thief\",\n        \"type\": \"Warning\"\n    }],\n    \"success\": true\n}\n```\n\n## Running against the **mainnet** with **folder** output enabled\n\n```console\n$ karl --rpc karl --rpc https://mainnet.infura.io/ --output folder\n```\n\n## Demo\n\nRunning locally with a specially crafted vulnerable contract:\n\n[![asciicast](https://asciinema.org/a/222983.svg)](https://asciinema.org/a/222983)\n\nRunning on the main net using [Infura](https://infura.io/):\n\n[![asciicast](https://asciinema.org/a/atfMqExP6RFXPzeza5adCozpg.svg)](https://asciinema.org/a/atfMqExP6RFXPzeza5adCozpg)\n\n## Troubleshooting\n\n### OpenSSL\n\nIf you get this error\n\n```error\n  #include \u003copenssl/aes.h\u003e\n          ^~~~~~~~~~~~~~~\ncompilation terminated.\nerror: command 'x86_64-linux-gnu-gcc' failed with exit status 1\n```\n\nYou must install the openssl source code libraries\n\n#### Ubuntu\n\n```console\n$ sudo apt-get install libssl-dev\n```\n\n## Credits\n\nThis tool is inspired by [Bernhard's](https://github.com/b-mueller/) initial prototyping and it heavily uses his project [Myth](https://github.com/ConsenSys/mythril-classic).\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fcleanunicorn%2Fkarl","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fcleanunicorn%2Fkarl","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fcleanunicorn%2Fkarl/lists"}