Bitcoin Forum
May 20, 2024, 11:51:14 PM *
News: Latest Bitcoin Core release: 27.0 [Torrent]
 
   Home   Help Search Login Register More  
Pages: [1]
  Print  
Author Topic: Blockchain.info - confirm IP address for callbacks  (Read 1607 times)
keatonatron (OP)
Sr. Member
****
Offline Offline

Activity: 308
Merit: 250


Jack of oh so many trades.


View Profile
May 22, 2013, 10:37:41 AM
 #1

Hi all,

The documentation for the Blockchain.info Receive Payment API says we should check the IP address of the caller to make sure it came from blockchain.info -- which is obviously a good idea (very easy to spoof payment notifications otherwise!).

I programmed my callback page to get the originating IP address, get the IP of blockchain.info, and compare the two.

It failed.

After some research, I found out the blockchain.info domain name is linked to both 141.101.112.196 and 190.93.243.195, and although my script was pulling these up okay, the callback was originating from a third IP address: 82.145.55.247.

Should I assume this is the dedicated callback server and I can hardcode it into my script as the address to check for?

I tried instead to take the IP address and do a reverse lookup of the hostname to compare that to "blockchain.info", but it looks like there isn't a proper reverse entry specified (the lookup fails).

Any suggestions of the best way to implement this security?

1KEATSvAhbB7yj2baLB5xkyJSnkfqPGAqk
keatonatron (OP)
Sr. Member
****
Offline Offline

Activity: 308
Merit: 250


Jack of oh so many trades.


View Profile
May 23, 2013, 02:55:29 AM
 #2

Hoping to bring this to the top of the stack--I probably posted at a time when most of the world was asleep.

1KEATSvAhbB7yj2baLB5xkyJSnkfqPGAqk
firepacket
Newbie
*
Offline Offline

Activity: 7
Merit: 0



View Profile
May 27, 2013, 06:17:00 AM
 #3

A proper callback API should have a server-side shared secret field. You shouldn't have to rely on IP addresses for authentication.
keatonatron (OP)
Sr. Member
****
Offline Offline

Activity: 308
Merit: 250


Jack of oh so many trades.


View Profile
May 27, 2013, 02:02:18 PM
 #4

A proper callback API should have a server-side shared secret field. You shouldn't have to rely on IP addresses for authentication.

Thanks for the feedback! It does allow me to pass a pre-specified parameter along with the callback, which is what I'm currently using for security. Hopefully that will be enough.

Locking it down by IP would be quite spoof-proof, but if the server's IP changed everything would stop working...

Thanks for dredging my post up to give it a proper answer  Grin

1KEATSvAhbB7yj2baLB5xkyJSnkfqPGAqk
Pages: [1]
  Print  
 
Jump to:  

Powered by MySQL Powered by PHP Powered by SMF 1.1.19 | SMF © 2006-2009, Simple Machines Valid XHTML 1.0! Valid CSS!