c - Shell security with hash -
for educational purposes i'm implementing simple remote shell program, , i'm trying wrap head around how make secure. first idea had require password. if client sends password, runs, if not, quits. then, applied simple hash function password, don't think makes more secure. in either case, if packets intercepted, attacker extract password or hashed password. what can make more secure there way use password/hashing safe basic packet interception? know ssh uses public/private keys encrypt , decrypt, more advanced need.
how challenge/response digests? server knows password "blah".
the client connects, , authenticates:
- client: let me in!
server: give challenge
"12345", number generated now!server remembers gave client
"12345".client wants authenticate
"blah", add end of server's challenge, , calculates sha-1 of result"12345blah".client: response
"6910972fb3148a63df7fda34bd6fccf3013d8d93"!server knows password
"blah", , issued challenge"12345"client—hence calculates sha-1 of"12345blah", , produces"6910972fb3148a63df7fda34bd6fccf3013d8d93". matches client's response …server: access granted!
important notes:
the server must 1 choose challenge. if client gets pick, attacker intercept 1 authentication attempt, , repeat same challenge , response valid user.
the fact server picks different challenge every time means attacker can't replay authentication. means server needs store challenge against client's connection or session somehow, since you'll need when respond.
you may want use stronger sha-1 (it's little broken iirc). may want other appending password challenge, security properties depend on underlying digest function.
i demonstrate password
"blah", nice thing now, can replace"blah"hash of"blah". server never needs store more hash, , client hashes password first before combining challenge , calculating digest.
Comments
Post a Comment