9 ms·
mCaptcha: Open-source proof-of-work captcha for websites
- tromp 3y agoSHA256-based Hashcash seems like a poor choice of PoW for a captcha that's supposed to incur a nontrivial cost for spammers. They can simply employ a SHA256 ASIC to crack the captcha at practically no cost.
- lucb1e 3y agoI agree, but you literally have no other option: https://developer.mozilla.org/en-US/docs/Web/API/SubtleCrypto/deriveKey https://developer.mozilla.org/en-US/docs/Web/API/SubtleCrypt... Web cryptography is stuck in the 1990s. PBKDF2 is the only available algorithm, which gives an attacker's GPUs a big advantage over honest users, let alone ASICs. Maybe a webassembly-based solution, implementing something like Bcrypt or Scrypt/Argon2, is comparable to a browser-native implementation, but that would have to be verified before taking my word for it. These algorithms provide varying amounts of memory-hardness (Bcrypt only 4KB but even that proved surprisingly effective), which causes contention on the GPU memory bus (they're only a bit faster than the CPU's memory bus, making the GPU have only a small advantage, on the order of 5x instead of 100x) and causes larger ASIC die sizes (which the Argon2 paper argues is what causes cost for the attacker). Source for the latter: https://github.com/P-H-C/phc-winner-argon2/blob/16d3df698db2486dde480b09a732bf9bf48599f9/argon2-specs.pdf https://github.com/P-H-C/phc-winner-argon2/blob/16d3df698db2... section 2.1 > We aim to maximize the cost of password cracking on ASICs. There can be different approaches to measure this cost, but we turn to one of the most popular – the time-area product [4, 16]. [...] > - The 50-nm DRAM implementation [10] takes 550 mm² per GByte; > - The Blake2b implementation in the 65-nm process should take about 0.1 mm² (using Blake-512 implementation in [11]); I understand from this that adding more memory on the ASIC/chip is more expensive than adding more computing power.
- notpushkin 3y agoOhhh, actualy mCaptcha seems to be using WASM already: https://mcaptcha.org/docs/api/browser https://mcaptcha.org/docs/api/browser So I think it should be possible to add another algo?
- tromp 3y agoA better choice would be a memory hard PoW (that's still instantly verifiable), where the performance gap between consumer and custom hardware can be limited to one or two orders of magnitude.
- xigoi 3y agoWhat if the consumer has almost no free space?
- lucb1e 3y agoThen you can trade-off processing power within reason. Modern websites are so heavy, it's not unusual to need a gigabyte of memory to use some of the heavier webpages. Using some megabytes (150MB I'd consider an upper bound of where the advantage will have leveled off for the coming years) is not typically impossible, and even 4KB is a lot better than no memory hardness at all.
- lucb1e 3y ago> that's still instantly verifiable Good point, current verification of password hashes takes as long as generating the hash. I seem to remember that there was a technique to avoid this, but it wasn't usable for passwords or something. Do you happen to have a pointer for what algorithm has this property?
- tromp 3y agoAsymmetric PoW algorithms, such as Cuckoo Cycle [1] or the poorly named Equihash [2] (which is not a hash function) do not lend themselves to password hashing, since a given problem instance can have 0 or 1 or many solutions. [1] https://github.com/tromp/cuckoo https://github.com/tromp/cuckoo [2] https://en.wikipedia.org/wiki/Equihash https://en.wikipedia.org/wiki/Equihash
- fabiospampinato 3y agoYou do have other options, you can build your PoW on repeated squarings instead.
- lucb1e 3y agoNot sure I understand. Numbers in JavaScript can't hold infinitely large numbers, so after a few squarings using x*x or Math.pow(x, 2) you're at float max (or at least lost some precision, breaking the proof) and would need to resort to custom code again rather than a hardware-accelerated browser-native operation.
- tromp 3y agoHe's talking about repeated squarings in a modular field, like integers mod N where N is the product of two large primes.
- notpushkin 3y agoRelated: mCaptcha – Proof of work based, privacy respecting CAPTCHA system – https://news.ycombinator.com/item?id=32340305 https://news.ycombinator.com/item?id=32340305 – Aug 2022 (96 comments) MCaptcha: FOSS privacy focused captcha system using proof-of-work – https://news.ycombinator.com/item?id=32340590 https://news.ycombinator.com/item?id=32340590 – Aug 2022 (5 comments)
- RcouF1uZ4gsC 3y agoProof of work = waste electricity. Basically, we are incentivizing people to waste electricity. The proof of work is basically proving you wasted electricity doing something useless. While I appreciate the goals behind this, I think proof of work is unethical in our current energy situation.
- pikrzyszto 3y agoOther captchas also waste (your and captchas' provider) electricity. For example reCaptcha requires tons of resources to track your moves to ensuring you're "not a robot". Sure, the data is also used to serve you ads but resources are still wasted.
- RcouF1uZ4gsC 3y agoBut as efficiency improves, the electricity usage goes down. With proof of work, as efficiency increases, the work increases to keep on wasting the same electricity. If electricity prices drop, the work increases to waste more electricity to keep the attack expensive enough.
- manmal 3y agoDo you think this needs more electricity than the whole recaptcha cloud? I seriously doubt it. My laptop would waste something like 0.006 watt hours per proof (0.5 seconds at 40 watt). Also, per the default setting, the proof complexity is lowered to almost zero when the server is at normal load.
- sn0wleppard 3y agoobviously not because no-one's using it yet - how much energy do you think it would waste if it completely replaced recaptcha?
- manmal 3y agoMy guess is that mcaptcha reduces energy consumption by an order of magnitude when compared with recaptcha. But could be wrong of course. It also saves human productivity.
- fanf2 3y agoProof of work proves not to work (2004) https://www.cl.cam.ac.uk/~rnc1/proofwork.pdf https://www.cl.cam.ac.uk/~rnc1/proofwork.pdf
- xtracto 3y agoPdf download warning.
- jeroenhd 3y agoI respect your dislike of direct download links, but what browsers still download PDFs these days?
- notpushkin 3y agoFirefox on Android, for example. I guess they just didn't want to add mobile UI to pdf.js?
- cpeterso 3y agoFirefox on Android supports PDF viewing (using pdf.js) as of version 111: https://www.mozilla.org/en-US/firefox/android/111.0/releasenotes/ https://www.mozilla.org/en-US/firefox/android/111.0/releasen...
- deleted 3y ago[deleted]
- xtracto 3y agoIm on brave mobile and it downloaded the pdf automatically when I clicked the link.
- hn92726819 3y agoAll of them. Sometimes they open the downloaded PDF in the internal viewer maybe, but PDF is a pretty dangerous format either way. It's getting safer to open them though.
- dimmke 3y agoI recently conducted an experiment - I removed client side CAPTCHAs from a form that had reCAPTCHA V2 and a ton of spam was getting through and instead sent the content to Akismet for scanning. It cut the spam getting through to 0. It made me think, are client side CAPTCHAs really worth it? They add so much friction (and page weight - reCAPTCHA v3 adds several hundreds KBs) to the experience (especially when you have to solve puzzles or identify objects) and are gamed heavily. I know these get used for more than form submissions, to stop bot sign ups etc… I feel like it’d be just as/more effective to use other heuristics on the backend: IP Address, blacklisting certain email domains, requiring email validation or phone validation, scanning logs, analyzing content submitted through forms
- kccqzy 3y agoThen you'd just give visitors of your websites no recourse and no information whatsoever on how to fix the problem. The benefit of client-side CAPTCHA is that humans at least can pass it and fix the problem even if something they don't control (such as their IP address having bad reputation due to shitty ISP) is causing problems. As a website operator it's easy to look at the spam that is getting through and be happy that's it's zero. But do you get any idea how many actual humans that you have incorrectly rejected? You don't have that data and it's really easy to screw up there. Of course if your website is small nobody cares. If you are bigger like Stripe you simply get bad publicity on HN. People on HN love to hate on mysterious bans and blocks just because they do something slightly unusual and your backend-only analysis flags them as suspicious. Abuse fighting is hard.
- jsnell 3y agoAnd just to be clear, it doesn't need to be either captchas or doing heuristic abuse detection on the backend. In the ideal case you're making a decision in the backend using all these heuristics and signals, but the outcome is not binary. Instead the outcome of the abuse detection logic is to choose from a range of options like blocking the request entirely, allowing it through, using a captcha, or if you're sophisticated enough doing other kinds of challenges. But proof of work has basically no value as am abuse challenge even in this kind of setup, the economics just can't work.
- voytec 3y ago> Try mCaptcha without joining > user: aaronsw password: password mixed feelings about this.
- thih9 3y agoNote, there are credentials for a test account, to try it without signing up. This is listed on the sign in page [1], just not very visible. > user: aaronsw password: password [1]: https://demo.mcaptcha.org/login https://demo.mcaptcha.org/login
- zb3 3y ago"Account not found" :<
- smusamashah 3y agoIt says 'Account not found'
- _Chief 3y agoLogging in shows a dashboard asking you to implement it on your site. That's not what I expect from a "demo" of a captcha. A recommendation would be; please use mcaptcha on the mcaptcha account sign up page at the least. It'd then provide an instant user UX demo which is one of the major pains of captchas. Or at least provide a link to the widget[1] for UX demo, where inspecting networks calls also shows the api calls in action [1] https://demo.mcaptcha.org/widget/?sitekey=pHy0AktWyOKuxZDzFfoaewncWecCHo23 https://demo.mcaptcha.org/widget/?sitekey=pHy0AktWyOKuxZDzFf...
- abetusk 3y agoNote that this was the original intent of proof of work (or very near it) [0]. Should you want to visit a site that has proof of work as a requirement but allows it to be done offline/deferred/transferred, then you've essentially re-invented some of the major aspects of cryptocurrency. [0] https://en.wikipedia.org/wiki/Proof_of_work#cite_note-DwoNao1992-3 https://en.wikipedia.org/wiki/Proof_of_work#cite_note-DwoNao...
- bawolff 3y agoIts not really reinventing if its the original idea. Hashcash came before bitcoin.
- f_devd 3y agoFunny coincidence I made the similar thing into a webcomponent a few weeks ago for a different purpose: click-to-reveal buttons to prevent scraping of public emails in static websites. It works by encrypting the content using the same deriveKey method varying the iterations to determine time 'cost'. Imo it's not really fit for most captchas situations since you can easily parallelize the execution by simply running multiple tabs/browsers or even hooking crypto/subtle up to an GPU/ASIC with a bit of hackery.
- remram 3y agoI don't understand the premise. The point of a CAPTCHA is to tell Computers and Humans Apart, that's what the CHA stands for. You cannot hope to do this test using a proof-of-work system where the work is computer work. Call this a client rate-limiter, or whatever else, but it is obviously not a CAPTCHA and cannot function in this way. Another obvious problem is that server hardware is vastly more powerful than the average user's device. If you set your challenge to an amount of work that doesn't meaningfully drive users away and/or drain their batteries, you are allowing a malicious server to pass your challenge tens of thousands of times an hour.
- tracker1 3y agoIs server hardware vastly more powerful? If you use a hashing algorithm that isn't easily parallel, then you're dedicating a single CPU core for that exercise. Now a server may have more cores, but they are often slower per-core than a client machine. And dedicating server resources has a cost. You'd slow a brute force attack to a relative crawl, especially if the target has a large volume of pre-defined work and answers. PBKDF2, as an example on 100k iterations can easily pin a CPU core for a few seconds. This is part of why I always have my authentication services separate from my applications, it reduces the DDoS vector. Now, you can shift work to the client as kind of an inverse-ddos rate limiter. Combine that with a websocket connection, where the browser is sending user events like mouse movement, touch, scroll, focus/blur and input/paste... the two, combined with event timing analysis can give you a pretty good guess if something is a real user. And if it isn't, definitely slowing down bots.
- remram 3y agoEven if your server is not vastly more powerful, your 1 second of proof-of-work means a single server can pass your challenge 3600 times an hour. The point is: a CAPTCHA has to be something that is easy for humans and hard for bots. This is at best the same level of effort from human('s devices) and bots. And realistically, more, because bots aren't battery-powered. It can't work.
- 3y ago
- emurlin 3y agoExploring Proof of Work (PoW) as a substitute for CAPTCHAs is an interesting idea (PoW was originally conceived as a spam deterrent, after all), and one that I have considered (and use) in some web properties I manage. Not only does it obviate 'trusted' third parties, but it also has the potential to reduce the risk of accessibility issues often associated with traditional CAPTCHA. It also seems like a solution that scales nicely, as each 'proof' is made by the client and verification is cheap, and like a solution that finally ends the arms race against malicious traffic by bypassing the need to 'prove humanity'. However, it's one of those solutions that look good on paper, but upon close inspection break down entirely or come with rather substantial tradeoffs. Ignore the environmental discussion about energy consumption for a moment, and let's face the reality that computational power is ridiculously inexpensive. As a thought exercise, imagine you're trying to use PoW to ward off spammers (or the attack du jour), and you decide that a 1-cent expenditure on computation would be a sufficient deterrent. Let's say that renting a server costs $100/month (a bit on the higher end), or 0.004 cents per second. So, if you wanted a PoW system that would cost the spammer 1 cent, you'd need to come up with a computational task that takes about 250 seconds, or over 4 minutes, to solve. That kind of latency just isn't practical in real-world applications. And that ignores that 1 cent is probably a ridiculously low price for protecting anything valuable. Of course, you may consider this as an alternative to regular CAPTCHA services. A quick search gives me that this costs something like $3 for 1000 CAPTCHAs solved, or 0.3 cents per CAPTCHA. This changes the above calculation to about 1 minute of compute, which still seems rather unacceptable considering that you might, e.g., drain your users' battery. So, overall, while I'd like for something like this to work, it probably only acts as a deterrent against attackers not running a full browser and who also aren't targeting you in particular.
- dontupvoteme 3y agoYou can scale the difficulty based on how likely an LLM thinks a post is spam or not (just don't only use OpenAI's please)
- remram 3y agoThat makes no difference, you'd have to scale the challenge to many minutes as GP explained, which is not something any user will go through. What's the point of issuing a challenge only spammers will pass?
- bawolff 3y agoPoW captchas are usually stupid ideas. You have to set the work factor low enough that low powered devices can do it without significant latency, but high enough that it actually stops attackers. Typically robots, unlike humans, dont care about doing things in real time. It might stop the really low effort attacks of people who are spamming billions of pages where the cpu time becomes expensive, but i don't think the ecconomics work for most scenarios. The current price for solving a js captcha is $3/1000 https://2captcha.com/ https://2captcha.com/ . The cost of cpu time for your PoW captcha is probably much lower. If people are willing to pay the $0.003 for a human to do it, they are going to be ok with buying the much cheaper compute.
- m463 3y agohonestly I think captchas that track you are stupid ideas. For pow, can't you just turn the dial to more work?
- bawolff 3y agoIf your captcha takes 20 minutes to complete, your users will leave.
- charcircuit 3y agoMeanwhile a spammer with the same machine will leave 72 messages every day that you will have to clean up for however long you keep the site up.
- jgalt212 3y agoFor the antiquarians on the site: http://www.hashcash.org/ http://www.hashcash.org/
- jmull 3y agoThis makes some sense for straight-up DDoS attacks. For bots/spam my intuition is this could not work. Computation is extremely cheap, and your average legit user is going to have a significantly lower threshold than your spammer.
- nullcipher 3y agoWhere is the code? I couldn't find a link. edit: https://github.com/mCaptcha/mCaptcha https://github.com/mCaptcha/mCaptcha
- johnchristopher 3y agoI could see my org adopt this if there was an out of the box way to add this to WordPress.
- gloosx 3y agoDamn, for some reason when I saw "Try mCaptcha" I was hoping it will show me the captcha right away and I can really try it in action. The saddest part is that on the login screen that follows, entering the wrong passwords for accounts doesn't trigger the captcha! And only then do you find out that there are credentials for some demo account that lets you into the dashboard. Do you think you can finally see the captcha then and try solving it yourself before putting it in front of your users? Not at all. The idea is great though and I hope they will be able to push back some of the reCaptcha dominance. A lot of good work is needed still of course. My advice for the team: show it better guys. Everybody knows how reCaptcha looks, but not your new mCaptcha, so you must present it in all its glory! And better show it right away.
- gvx 3y agoI had the same idea. If you look at the sitekeys you can click "View deployment". It's just a "I'm not a robot" checkbox. If you click it, it does some POW stuff in the background and that's it. It's more of a rate limiter than a CAPTCHA provider like others have said, but given how cheap CAPTCHA-solving services are currently, I don't know if there's much of a difference in practice anyway.
- anonzzzies 3y agoWhat is a good captcha for gdpr safe deployment that doesn't require a cookie banner? Edit: Open source would be great.
- layer8 3y agohttps://friendlycaptcha.com/ https://friendlycaptcha.com/ https://www.captcha.eu/ https://www.captcha.eu/
- fabiospampinato 3y agoFunnily enough I've recently implemented [0] a little proof-of-work generator (or more specifically a time-lock puzzle [1] generator), which is the base building block on top which something like this can be built. It's a very cool idea imo, you generate a cryptographic puzzle that's cheap for you to make, cheap for you to verify if its solved, and potentially cheap-enough for legitimate users to solve, but expensive-enough that users making too many requests would find solving them prohibitively expensive. I wish something like this was bolted onto email protocols, it would just cost more to be a spammer than it'd be worth it. Interesting how mCaptcha seems based on sha256, I don't know enough but it would be worth checking how much the algorithm can be sped up with (already existing) dedicated ASICs, if the attacker can solve the puzzle like 10000x faster than normal users you just can't crank the difficulty of the puzzle high enough and for motivated attackers this becomes basically useless. Basing this of on repeated squarings, like the RSW paper on time-lock puzzles did, seems potentially better. [0]: https://github.com/fabiospampinato/crypto-puzzle https://github.com/fabiospampinato/crypto-puzzle [1]: https://people.csail.mit.edu/rivest/pubs/RSW96.pdf https://people.csail.mit.edu/rivest/pubs/RSW96.pdf
- Alifatisk 3y agoAlso similar wehatecaptchas.com
- dontupvoteme 3y agoSo make a Captcha with generative AI itself. There is no training data if stable diffusion just created a CAPTCHA which has only been seen a few hundred times across the world.