Unix Technical Forum

[PATCH] Buffer overflow in lib/libc/bcrypt.c

This is a discussion on [PATCH] Buffer overflow in lib/libc/bcrypt.c within the mailing.openbsd.tech forums, part of the OpenBSD category; --> encode_salt() in lib/libc/bcrypt.c writes a 7 byte prefix, a base64 encoding of a 16 byte string (16 * 4/3 ...


Go Back   Unix Technical Forum > Unix Operating Systems > OpenBSD > mailing.openbsd.tech

Register FAQ Members List Calendar Search Today's Posts Mark Forums Read
  #1 (permalink)  
Old 02-18-2008, 08:44 AM
Matthew R. Dempsky
 
Posts: n/a
Default [PATCH] Buffer overflow in lib/libc/bcrypt.c

encode_salt() in lib/libc/bcrypt.c writes a 7 byte prefix, a base64
encoding of a 16 byte string (16 * 4/3 rounded up bytes), and then a
null terminator into the gsalt global variable which only has enough
room for the base64 encoding.

Index: lib/libc/crypt/bcrypt.c
================================================== =================
RCS file: /cvs/src/lib/libc/crypt/bcrypt.c,v
retrieving revision 1.20
diff -p -u -r1.20 bcrypt.c
--- lib/libc/crypt/bcrypt.c 3 Apr 2006 19:55:49 -0000 1.20
+++ lib/libc/crypt/bcrypt.c 4 Jul 2006 06:23:23 -0000
@@ -73,7 +73,7 @@ static void encode_base64(u_int8_t *, u_
static void decode_base64(u_int8_t *, u_int16_t, u_int8_t *);

static char encrypted[_PASSWORD_LEN];
-static char gsalt[BCRYPT_MAXSALT * 4 / 3 + 1];
+static char gsalt[7 + (BCRYPT_MAXSALT * 4 + 2) / 3 + 1];
static char error[] = ":";

const static u_int8_t Base64Code[] =

Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
Reply


Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On
Forum Jump


All times are GMT. The time now is 04:54 PM.


Powered by vBulletin® Version 3.6.5
Copyright ©2000 - 2008, Jelsoft Enterprises Ltd.
SEO by vBSEO 3.2.0
www.UnixAdminTalk.com