pull down to refresh

It seems I can repeatedly send two requests and get more than 3 times the payout:

imgbb

POST https://bitcoin-mastermind.com/wp-admin/admin-ajax.php
action=getBolt11&email=Scroogey%40stacker.news&amount=10&callerType=user

Take the invoice from the response and put it into

POST https://bitcoin-mastermind.com/wp-admin/admin-ajax.php
action=pay_bolt11_invoice&bolt11=LNBC100...&quiz_id=8&lightning_address=Scroogey%40stacker.news&nonce=29e5cc3667&callerType=user&totalSats=10

Ad infinitum...

You can change the amount as well.

reply

There is a check in lightning_address.php line 280.

Why is that not working at all?

Because it's checking the totalSats parameter provided by the client, not the value encoded in the invoice (provided in the first call as amount=10)!

reply

Good catch! Never trust the client.

reply

The getBolt11 function also has an exploitable flaw:

It asks the external (!) Bolt11 server for parameters related to the user-provided address, and honors minSendable in a funny way:

$minAmount = $lnurlDetails->minSendable;
$payAmount = ($amount * 1000 > $minAmount) ? $amount * 1000 : $minAmount;

An attacker can use an address that leads to an attacker-controlled Bolt11 resolver, which returns an absurdly high minimum. The logic above will then use that (instead of the amount due)!

reply
view on youtu.be

That's brutal.

reply

interesting! it doesn't boot your request after 3 tries with the same lightning address?

reply

It seems to rely on the client sending a request to get itself counted:

req

The client can simply skip this call to get endless calls.

All the logic should be in the server: use a single call to submit the answers, and have the server count the address, generate and pay the invoice in one step. You can't rely on the client following any expected procedure. Hackers will do any call in any order with any parameter to exploit you.

reply

Not when I resend the requests manually (through the Firefox web tools). It accepts the same nonce every time.

reply