Subject: | Format string vulnerability with MM_LOG usage |
Date: | Wed, 19 Nov 2014 10:59:40 -0500 |
To: | bug-Email-AddressParser [...] rt.cpan.org |
From: | Jonathan Bastien-Filiatrault <jonathan [...] zerospam.ca> |
In rfc822_parse_adrlist:
s = isalnum (c) ? "Must use comma to separate addresses: %.80s" :
"Unexpected characters at end of address: %.80s";
sprintf (tmp,s,string);
MM_LOG (tmp,PARSE);
After the sprintf call, tmp contains part of a user-supplied string
which may contain printf style formatting instructions. tmp is then
passed as a format argument to MM_LOG which is a wrapper around fprintf.
Since MM_LOG is never passed additional arguments, it is not useful to
treat the string argument as a format string. Redefining MM_LOG like
this would close this vulnerability.
Original:
#define MM_LOG(a,b) fprintf(stderr, a)
Modified:
#define MM_LOG(a,b) fputs(a, stderr)
Thanks for looking into this,
Jonathan
--
Logo ZEROSPAM Jonathan Bastien-Filiatrault
Administrateur de système
System Administrator
T : 514-527-3232 x 209
F : 514-527-1201
jonathan.bastien-filiatrault@zerospam.ca
<mailto:jonathan.bastien-filiatrault@zerospam.ca>