{"id":27877057,"url":"https://github.com/daedalus/breakingecdsawithlll","last_synced_at":"2025-05-05T02:55:55.102Z","repository":{"id":66971401,"uuid":"272532532","full_name":"daedalus/BreakingECDSAwithLLL","owner":"daedalus","description":"Breaking ECDSA (not so broken) with LLL","archived":false,"fork":false,"pushed_at":"2025-03-31T00:43:03.000Z","size":37,"stargazers_count":81,"open_issues_count":0,"forks_count":25,"subscribers_count":7,"default_branch":"master","last_synced_at":"2025-03-31T01:25:08.658Z","etag":null,"topics":["cryptography","cve-2024-31497","ecdsa","lattice-reduction","lll","trailofbits"],"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/daedalus.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE.txt","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":"2020-06-15T20:02:29.000Z","updated_at":"2025-03-31T00:43:06.000Z","dependencies_parsed_at":"2025-03-18T22:31:43.195Z","dependency_job_id":null,"html_url":"https://github.com/daedalus/BreakingECDSAwithLLL","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/daedalus%2FBreakingECDSAwithLLL","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/daedalus%2FBreakingECDSAwithLLL/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/daedalus%2FBreakingECDSAwithLLL/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/daedalus%2FBreakingECDSAwithLLL/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/daedalus","download_url":"https://codeload.github.com/daedalus/BreakingECDSAwithLLL/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":252429927,"owners_count":21746571,"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":["cryptography","cve-2024-31497","ecdsa","lattice-reduction","lll","trailofbits"],"created_at":"2025-05-05T02:55:54.556Z","updated_at":"2025-05-05T02:55:55.092Z","avatar_url":"https://github.com/daedalus.png","language":"Python","funding_links":[],"categories":[],"sub_categories":[],"readme":"![lint_python](https://github.com/daedalus/BreakingECDSAwithLLL/workflows/lint_python/badge.svg)\n[![GitHub issues](https://img.shields.io/github/issues/daedalus/BreakingECDSAwithLLL.svg)](https://github.com/daedalus/BreakingECDSAwithLLL/issues)\n[![GitHub forks](https://img.shields.io/github/forks/daedalus/BreakingECDSAwithLLL.svg)](https://github.com/daedalus/BreakingECDSAwithLLL/network)\n[![GitHub stars](https://img.shields.io/github/stars/daedalus/BreakingECDSAwithLLL.svg)](https://github.com/daedalus/BreakingECDSAwithLLL/stargazers)\n\n\n\n# BreakingECDSAwithLLL\nBreaking ECDSA (not so broken) with LLL\n\nThe main idea behing this attack is the theorem of the great numbers, if you have a crypto funcion and lots of samples (signatures) generated with a private key having a bias in the nonce generation, then they will tend to converge to a single point which happens to be the private key, this is equal to solving the hidden number problem.\nAnd for solving it we employ Lenstra-Lenstra-Lovasz lattice reduction algorithm.\n\nThe main counter measure against this kind of attack is using deterministic signatures like Z=H(h||d), where Z is the digest, H is a crypto-secure hash funcion, h the nonce, and d our private key. This is needed in order to have a even distributed, random looking nonce.\n\nHeavily based on previous work\n  ```\nhttps://blog.trailofbits.com/2020/06/11/ecdsa-handle-with-care/\nhttps://www.youtube.com/watch?v=6ssTlSSIJQE\n  ```\n\nFirst install dependencies:\n  ```\n  sudo apt-get install sagemath python3-ecdsa\n  ```\n\nThen run:\n  ```\n  # (Victim) \n  # This will generate 6 weak signatures with a known key, args:(privkey,bits,nonces)\n  python3 weak_signature_generator.py e3b0c44298fc1c149afbf4c8996fb92427ae41e4649b934ca495991b7852b855 176 6 \u003e nonces.csv\n  \n  # (Attacker) \n  # Will find the private key if LLL converges, args:(bits,nonces)\n  python3 crack_weak_ECDSA_nonces_with_LLL.py nonces.csv 176 6 | grep -e e3b0c44298fc1c149afbf4c8996fb92427ae41e4649b934ca495991b7852b855\n  ```\n\nThis PoC was referenced in [CVE-2024-31497](https://nvd.nist.gov/vuln/detail/CVE-2024-31497) on 4/16/2024.\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fdaedalus%2Fbreakingecdsawithlll","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fdaedalus%2Fbreakingecdsawithlll","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fdaedalus%2Fbreakingecdsawithlll/lists"}