Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

RCrypto: segfault on running "-E blowfish" #4287

Closed
kishorbhat opened this issue Mar 10, 2016 · 11 comments
Closed

RCrypto: segfault on running "-E blowfish" #4287

kishorbhat opened this issue Mar 10, 2016 · 11 comments
Milestone

Comments

@kishorbhat
Copy link
Contributor

Command $ rahash2 -S "abc" -E blowfish -s "testing" results in a segmentation fault.

Relevant code is here.
Suspicions are on invalid assumptions regarding the key, but there may be other issues.

@Maijin Maijin added the bug label Mar 10, 2016
@zonkzonk
Copy link
Contributor

So SetHashString takes two arguments?

@crowell
Copy link
Collaborator

crowell commented Mar 11, 2016

r_crypto_final (cry, NULL, 0);
return (cry && cry->h && cry->h->final)? cry->h->final (cry, buf, len): 0;
return update (cry, buf, len);
blowfish_crypt (&st, buf, obuf, len);
nice, buf is null
left = (inbuf[0] << 24 | inbuf[1] << 16 | inbuf[2] << 8 | inbuf[3]);
segfault.

@alvarofe
Copy link
Contributor

yes, in blowfish_crypt keylen is 3 but it assumes outbuf of size 8 so is a oob write. Can you fix it @therealkbhat ?

@alvarofe alvarofe added this to the 0.10.2 milestone Mar 11, 2016
@kishorbhat
Copy link
Contributor Author

@alvarofe yes, I'll fix this soon.

@radare
Copy link
Collaborator

radare commented Mar 13, 2016

any update on this?

On Sun, Mar 13, 2016 at 9:01 AM Kishor Bhat [email protected]
wrote:

@alvarofe https://github.com/alvarofe yes, I'll fix this soon.


Reply to this email directly or view it on GitHub
#4287 (comment).

@kishorbhat
Copy link
Contributor Author

@radare Sorry, I was occupied over the weekend.

I'm having trouble debugging this. The code operates on key and plaintext string as hex bytes.

Even with $ rahash2 -E blowfish -S "aaaaaaaa" -s "aaaaaaaa", it produces one block (8 bytes) of ciphertext. However, it calls blowfish_crypt on the "next" block, which doesn't exist, and it segfaults. len gets set to 0, and update is called again. Why?

Also, @crowell , I don't see the null. :/

@radare
Copy link
Collaborator

radare commented Mar 14, 2016

anyway, tired of waiting I pushed the one-line fix.

@radare radare closed this as completed Mar 14, 2016
@radare
Copy link
Collaborator

radare commented Mar 14, 2016

23af75f

@XVilka XVilka reopened this Mar 14, 2016
@XVilka
Copy link
Contributor

XVilka commented Mar 14, 2016

Has just been disabled, still require proper fix, @therealkbhat

@radare
Copy link
Collaborator

radare commented Mar 14, 2016

Define proper fix. Probably needs proper testing, nothing more, or maybe im missing something. the null deref was pretty clear. and it misses an error message maybe, but not much more imho.

Also, im aware decryption doesnt works because the function is not referenced anywhere, but this is unrelated to this issue

@Maijin
Copy link
Contributor

Maijin commented Mar 14, 2016

I have unchecked the blowfish support in main issue then #4254

@Maijin Maijin closed this as completed Mar 14, 2016
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

7 participants