Bitcoin Forum
May 26, 2024, 09:02:59 AM *
News: Latest Bitcoin Core release: 27.0 [Torrent]
 
   Home   Help Search Login Register More  
Pages: [1]
  Print  
Author Topic: Properly securing your bitcoin web API  (Read 944 times)
greBit (OP)
Hero Member
*****
Offline Offline

Activity: 714
Merit: 500


View Profile
October 11, 2012, 03:41:08 PM
 #1

I was just hoping for a bit of feedback regarding a proposed method for securing access to a state-less web API server which could help protect bitcoins.

I would like it such that each request is signed by the client, in such a way that I can guarantee that the issuer of the request is a valid user of our site.

Server and client have a shared secret - i.e. the hashed password of the user, so...

  • Server sends a random nonce value to the client
  • Client constructs a signing key K as (nonce,hashed_password)
  • Client signs each request with key K
    • e.g. ('delete image_x',user_id,request_signature)
  • Server then checks the signature as being valid for every request before processing it.


Are there any obvious flaws?

cheers!
Come-from-Beyond
Legendary
*
Offline Offline

Activity: 2142
Merit: 1009

Newbie


View Profile
October 11, 2012, 04:14:06 PM
 #2

Is it via HTTPS? If not and the nonce is not changed everytime then a man-in-the-middle can repeat a client's message. If it's something like "Pay X to Y" then it could be dangerous.
acoindr
Legendary
*
Offline Offline

Activity: 1050
Merit: 1002


View Profile
October 11, 2012, 08:08:20 PM
 #3

1. most obvious is limiting attempts getting it wrong before locking user out, otherwise brute force may be option
2. how secure is the database containing the hashed password? if the db can be compromised (sql injection etc.) then the password might be brute forced if not very long or not hashed in secure way
3. who has access to the server? if a hosting company then any weak link there means compromise

The method you describe seems secure, but that's just one piece of the overall puzzle of course.
BkkCoins
Hero Member
*****
Offline Offline

Activity: 784
Merit: 1009


firstbits:1MinerQ


View Profile WWW
October 12, 2012, 11:53:26 AM
 #4

How does the server verify the signed response without having a private key? You said it sends a nonce out but it can't check the signature coming back without a matching key.

The way I did this was have the client generate a key pair and send the public key to the server. this assumes the first login is genuine but after that all subsequent data can be verified.

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!