{"id":26202276,"url":"https://github.com/astef/word-of-wisdom","last_synced_at":"2025-07-23T19:32:05.571Z","repository":{"id":213888448,"uuid":"735112954","full_name":"astef/word-of-wisdom","owner":"astef","description":"Demo TCP server protected from DDoS with PoW challenge-response protocol","archived":false,"fork":false,"pushed_at":"2023-12-28T17:00:15.000Z","size":31,"stargazers_count":0,"open_issues_count":0,"forks_count":1,"subscribers_count":1,"default_branch":"main","last_synced_at":"2025-03-12T03:37:03.638Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":null,"language":"Go","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/astef.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","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":"2023-12-23T17:54:41.000Z","updated_at":"2023-12-26T07:49:52.000Z","dependencies_parsed_at":"2025-03-12T03:34:19.717Z","dependency_job_id":"b317499d-a84d-4969-9c24-0c73f4a6e4dc","html_url":"https://github.com/astef/word-of-wisdom","commit_stats":null,"previous_names":["astef/word-of-wisdom"],"tags_count":0,"template":false,"template_full_name":null,"purl":"pkg:github/astef/word-of-wisdom","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/astef%2Fword-of-wisdom","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/astef%2Fword-of-wisdom/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/astef%2Fword-of-wisdom/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/astef%2Fword-of-wisdom/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/astef","download_url":"https://codeload.github.com/astef/word-of-wisdom/tar.gz/refs/heads/main","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/astef%2Fword-of-wisdom/sbom","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":266738301,"owners_count":23976414,"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","status":"online","status_checked_at":"2025-07-23T02:00:09.312Z","response_time":66,"last_error":null,"robots_txt_status":null,"robots_txt_updated_at":null,"robots_txt_url":"https://github.com/robots.txt","online":true,"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":[],"created_at":"2025-03-12T03:34:03.214Z","updated_at":"2025-07-23T19:32:05.545Z","avatar_url":"https://github.com/astef.png","language":"Go","funding_links":[],"categories":[],"sub_categories":[],"readme":"# Word of Wisdom\n\nDemo TCP server protected from DDoS with PoW stateless challenge-response protocol\n\n## PoW algorithm\n\nIn the terminology of the [Hashcash - A Denial of Service Counter-Measure](http://www.hashcash.org/hashcash.pdf) white paper, in this demo server **hashcash-cookie** algorithm is used. The main advantage over other interactive Hashcash algorithms is it's resistance to DDoS, because server doesn't hold the connection while client is solving the challenge. In order to make this communication secure, challenge is signed by the server. Client passes signature together with the solution, and then server checks that the challange solved is exactly the one, which was signed earlier.\n\n**SHA256** is used as an _interactive cost function_.\n\n**HMACSHA256** is used for signing/verifying the challenge on the server.\n\nImportant distinctive features of this implementation are:\n\n- Protocol is designed to be **stateless**, just like HTTP request-response, because the number TCP connections is critical for resisting the DDoS attack\n- Challenge includes expiration time, so an attacker's ability to accumulate solutions is limited. Moreover, this nice feature lets the server to dynamically change algorithm parameters and loose support of old challenges by just waiting for them to expire.\n- Client IP address is added to the challenge signature by the server, so it is impossible to change it between the challenge-response calls, so an attacker won't be able to accumulate solutions from different locations and spend them all in one location with the purpose of DoS\n- It has zero dependencies, and quite low amount of source code: 10 files, \u003c600 non-blank non-comment lines\n\n## Running\n\n```\ndocker compose up --force-recreate --build server --build client\n```\n\n## Known problems and limitations\n\n- Server secret is re-generated on every start, so challenges should not survive server restart, or be used with different servers\n- It fails with Go `1.21.0`, because of the [bug](https://github.com/golang/go/issues/62117), please use Go `1.21.5` or higher\n- Message format is determined by `encoding/gob`, which is not interoperable format. This is done intentionally to simplify the implementation. It is easily replaceable with a more advanced formatters\n- Unit-tests are missing, but solution is testable (e.g. see auto-generated draft here: `cmd/server/handler_test.go`), so it just waits for some more time to be spent on it\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fastef%2Fword-of-wisdom","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fastef%2Fword-of-wisdom","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fastef%2Fword-of-wisdom/lists"}