mirror of
https://github.com/curl/curl.git
synced 2026-08-25 09:13:31 +03:00
formpost: better random boundaries
When doing multi-part formposts, libcurl used a pseudo-random value that was seeded with time(). This turns out to be bad for users who formpost data that is provided with users who then can guess how the boundary string will look like and then they can forge a different formpost part and trick the receiver. My advice to such implementors is (still even after this change) to not rely on the boundary strings being cryptographically strong. Fix your code and logic to not depend on them that much! I moved the Curl_rand() function into the sslgen.c source file now to be able to take advantage of the SSL library's random function if it provides one. If not, try to use the RANDOM_FILE for seeding and as a last resort keep the old logic, just modified to also add microseconds which makes it harder to properly guess the exact seed. The formboundary() function in formdata.c is now using 64 bit entropy for the boundary and therefore the string of dashes was reduced by 4 letters and there are 16 hex digits following it. The total length is thus still the same. Bug: http://curl.haxx.se/bug/view.cgi?id=1251 Reported-by: "Floris"
This commit is contained in:
parent
cb1aa8b0e3
commit
365c5ba395
16 changed files with 125 additions and 145 deletions
|
|
@ -7,7 +7,7 @@
|
|||
* | (__| |_| | _ <| |___
|
||||
* \___|\___/|_| \_\_____|
|
||||
*
|
||||
* Copyright (C) 1998 - 2012, Daniel Stenberg, <daniel@haxx.se>, et al.
|
||||
* Copyright (C) 1998 - 2013, Daniel Stenberg, <daniel@haxx.se>, et al.
|
||||
*
|
||||
* This software is licensed as described in the file COPYING, which
|
||||
* you should have received as part of this distribution. The terms
|
||||
|
|
@ -73,6 +73,10 @@ void Curl_ossl_md5sum(unsigned char *tmp, /* input */
|
|||
unsigned char *md5sum /* output */,
|
||||
size_t unused);
|
||||
|
||||
/* this backend provides these functions: */
|
||||
#define have_curlssl_random 1
|
||||
#define have_curlssl_md5sum 1
|
||||
|
||||
/* API setup for OpenSSL */
|
||||
#define curlssl_init Curl_ossl_init
|
||||
#define curlssl_cleanup Curl_ossl_cleanup
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue