I'll preface this by saying I know approximately 0 about cyber-sec
I've made a server that will allow smart phones to act as a remote control for my house (eg turn lights on/off and unlock doors). Obviously the security of this server is very important to me. I would also like the latency on the app to be as low as possible so I designed the system to minimize the number of distinct calls to the server. If any of you could point out any vulnerabilities and/or unnecessary steps I'd appreciate it:
A message to the server takes the form of a get request to
/[username]/[command]/[random noise]/[signature]
I am using Sha256 as a hash function. the signature is calculated with
Sha256( Sha256( [username]+[password]+[command]+[random noise] ) + [previous successful signature] )
+
in this context means concatenation
If at any time you loose track of the previous successful signature you can request it. That is, the previous successful signature is public knowledge (and obviously that signature won't work twice in a row).
So far as I can surmise, I am not vulnerable to a replay attack (as the prev sig contributes to the next sig) nor a length extension attack (as appending to the message won't help and even if it did you could only append to the inner Sha256 instead of actual data).
Am I missing anything? Is my system secure?
username , password , command
can all be recovered from [username]+[password]+[command]+[random noise].username,password,command
can't necessarily be recovered from [username]+[password]+[command]+[random noise] then you may be misusing concatenation.