Commit Graph

123517 Commits

Author SHA1 Message Date
Niels Dossche
c283c3ab0b Sanitize libxml2 globals before parsing
Fixes GHSA-3qrf-m4j2-pcrr.

To parse a document with libxml2, you first need to create a parsing context.
The parsing context contains parsing options (e.g. XML_NOENT to substitute
entities) that the application (in this case PHP) can set.
Unfortunately, libxml2 also supports providing default set options.
For example, if you call xmlSubstituteEntitiesDefault(1) then the XML_NOENT
option will be added to the parsing options every time you create a parsing
context **even if the application never requested XML_NOENT**.

Third party extensions can override these globals, in particular the
substitute entity global. This causes entity substitution to be
unexpectedly active.

Fix it by setting the parsing options to a sane known value.
For API calls that depend on global state we introduce
PHP_LIBXML_SANITIZE_GLOBALS() and PHP_LIBXML_RESTORE_GLOBALS().
For other APIs that work directly with a context we introduce
php_libxml_sanitize_parse_ctxt_options().
2023-07-31 19:47:19 +01:00
Niels Dossche
80316123f3 Fix buffer mismanagement in phar_dir_read()
Fixes GHSA-jqcx-ccgc-xwhv.
2023-07-31 19:47:05 +01:00
Remi Collet
be71cadc2f
[ci skip] add CVE in NEWS 2023-06-22 08:03:25 +02:00
Pierrick Charron
32c7c433ac
Fix wrong backporting of previous soap patch 2023-06-06 18:49:32 -04:00
Pierrick Charron
b720ab99f8
Update NEWS 2023-06-06 17:59:43 -04:00
Remi Collet
0572448263
Fix GH-11382 add missing hash header for bin2hex 2023-06-06 17:56:19 -04:00
Niels Dossche
ac4254ad76
Fix missing randomness check and insufficient random bytes for SOAP HTTP Digest
If php_random_bytes_throw fails, the nonce will be uninitialized, but
still sent to the server. The client nonce is intended to protect
against a malicious server. See section 5.10 and 5.12 of RFC 7616 [1],
and bullet point 2 below.

Tim pointed out that even though it's the MD5 of the nonce that gets sent,
enumerating 31 bits is trivial. So we have still a stack information leak
of 31 bits.

Furthermore, Tim found the following issues:
* The small size of cnonce might cause the server to erroneously reject
  a request due to a repeated (cnonce, nc) pair. As per the birthday
  problem 31 bits of randomness will return a duplication with 50%
  chance after less than 55000 requests and nc always starts counting at 1.
* The cnonce is intended to protect the client and password against a
  malicious server that returns a constant server nonce where the server
  precomputed a rainbow table between passwords and correct client response.
  As storage is fairly cheap, a server could precompute the client responses
  for (a subset of) client nonces and still have a chance of reversing the
  client response with the same probability as the cnonce duplication.

  Precomputing the rainbow table for all 2^31 cnonces increases the rainbow
  table size by factor 2 billion, which is infeasible. But precomputing it
  for 2^14 cnonces only increases the table size by factor 16k and the server
  would still have a 10% chance of successfully reversing a password with a
  single client request.

This patch fixes the issues by increasing the nonce size, and checking
the return value of php_random_bytes_throw(). In the process we also get
rid of the MD5 hashing of the nonce.

[1] RFC 7616: https://www.rfc-editor.org/rfc/rfc7616

Co-authored-by: Tim Düsterhus <timwolla@php.net>
2023-06-06 17:53:45 -04:00
Gabriel Caruso
0e45ed772d
[ci skip] Next release will be 8.0.29 2023-02-14 15:19:11 +01:00
Remi Collet
e86d8704b4
more config for new FPM tests 2023-02-14 14:13:40 +01:00
Jakub Zelenka
937b1e38e2
Fix missing colon in NEWS 2023-02-14 10:46:48 +00:00
Jakub Zelenka
eef29d434a
Change NEWS for GHSA-54hq-v5wp-fqgv as it is for all SAPIs 2023-02-14 10:42:40 +00:00
Jakub Zelenka
caaaf75990
Fix incorrect character in NEWS 2023-02-14 10:33:56 +00:00
Jakub Zelenka
054c7b09f9 Update NEWS 2023-02-14 10:23:59 +00:00
Jakub Zelenka
716de0cff5
Introduce max_multipart_body_parts INI
This fixes GHSA-54hq-v5wp-fqgv DOS vulnerabality by limitting number of
parsed multipart body parts as currently all parts were always parsed.
2023-02-14 10:21:23 +00:00
Jakub Zelenka
e45850c195
Fix repeated warning for file uploads limit exceeding 2023-02-14 10:21:07 +00:00
Stanislav Malyshev
b5ccaaf613 Update NEWS 2023-02-12 21:04:31 -07:00
Niels Dossche
ec10b28d64 Fix array overrun when appending slash to paths
Fix it by extending the array sizes by one character. As the input is
limited to the maximum path length, there will always be place to append
the slash. As the php_check_specific_open_basedir() simply uses the
strings to compare against each other, no new failures related to too
long paths are introduced.
We'll let the DOM and XML case handle a potentially too long path in the
library code.
2023-02-12 20:56:19 -07:00
Stanislav Malyshev
af2ddc6426 Update NEWS 2023-02-12 20:53:06 -07:00
Tim Düsterhus
a92acbad87 crypt: Fix possible buffer overread in php_crypt() 2023-02-12 20:46:51 -07:00
Tim Düsterhus
c840f71524 crypt: Fix validation of malformed BCrypt hashes
PHP’s implementation of crypt_blowfish differs from the upstream Openwall
version by adding a “PHP Hack”, which allows one to cut short the BCrypt salt
by including a `$` character within the characters that represent the salt.

Hashes that are affected by the “PHP Hack” may erroneously validate any
password as valid when used with `password_verify` and when comparing the
return value of `crypt()` against the input.

The PHP Hack exists since the first version of PHP’s own crypt_blowfish
implementation that was added in 1e820eca02.

No clear reason is given for the PHP Hack’s existence. This commit removes it,
because BCrypt hashes containing a `$` character in their salt are not valid
BCrypt hashes.
2023-02-12 20:46:44 -07:00
Gabriel Caruso
255e08ac56
Revert "Make build work with newer OpenSSL"
This reverts commit 5f90134bb6.
2023-01-03 13:00:44 -03:00
Gabriel Caruso
c2737b40d7
[ci skip] Next release will be 8.0.28 2023-01-03 11:39:21 -03:00
Gabriel Caruso
4ce48e9a39
[ci skip] Prepare for PHP 8.0.27 GA 2023-01-03 11:36:20 -03:00
Christoph M. Becker
cf5dac07d2
Skip newly added test on 32bit platforms
That bug didn't affect 32bit platforms, and besides, it is rather
unlikely that allocating a 2GB string works on such platforms.
2022-12-19 16:04:29 +01:00
Stanislav Malyshev
05c35137cd Add NEWS 2022-12-18 23:24:53 -07:00
Stanislav Malyshev
5f90134bb6 Make build work with newer OpenSSL 2022-12-18 22:52:30 -07:00
Christoph M. Becker
921b6813da Fix #81740: PDO::quote() may return unquoted string
`sqlite3_snprintf()` expects its first parameter to be `int`; we need
to avoid overflow.
2022-12-18 22:41:43 -07:00
Petr Sumbera
72da2b02e2
php-fpm: fix Solaris port events.mechanism
Closes GH-9959.
2022-11-22 18:01:15 +00:00
George Wang
4bdfce6c1a Use __atomic_xxxx() instead of __sync_xxxx() for lsapi. 2022-11-20 19:30:07 -05:00
Ilija Tovilo
cdc0a8b06b
Add wordpress to community build
Closes GH-9942
2022-11-17 11:33:19 +01:00
Jakub Zelenka
db2d32f476 Introduce TEST_FPM_EXTENSION_DIR for FPM tests with shared extensions 2022-11-13 19:04:43 +00:00
Ilija Tovilo
da54664186
[skip ci] Skip function JIT in nightly for ASAN
This avoids the 6h timeout.
2022-11-11 19:57:00 +01:00
Sara Golemon
ac508301c9
Bump for 8.0.27 2022-11-08 22:10:29 +00:00
Christoph M. Becker
4c35d6440b
Don't skip test on Windows due to missing ext/posix
ext/posix is not available on Windows, but there is no need to check
for root (i.e. elevated privileges) on this platform, either.

Closes GH-9886.
2022-11-07 15:01:25 +01:00
Arnaud Le Blanc
1d67e34c49 [ci skip] NEWS 2022-11-04 15:58:07 +01:00
Arnaud Le Blanc
5d1f3e047c
Fix generator memory leaks when interrupted during argument evaluation (#9756) 2022-11-04 15:55:55 +01:00
Ilija Tovilo
75970077b0
Migrate i386 to GitHub actions
Closes GH-9856
2022-11-03 14:34:54 +01:00
Christoph M. Becker
d1c9ff5642
Fix potential NULL pointer dereference Windows shm*() functions
`shm_get()` (not to be confused with `shmget()`) returns `NULL` if
reallocation fails; we need to cater to that when calling the function.

Closes GH-9872.
2022-11-02 14:51:59 +01:00
Derick Rethans
2b5bed904e Updated to version 2022.6 (2022f) 2022-11-02 09:43:37 +00:00
Derick Rethans
4f2955c179 Merge branch 'PHP-7.4' into PHP-8.0 2022-10-31 15:02:56 +00:00
Derick Rethans
004cb82750 Bumb versions 2022-10-31 15:02:21 +00:00
Jakub Zelenka
8229649045
Fix GH-9770: Add small timeout in status-listen test
This is to allow more time to switch for active to idle in scoreboard as
it seems that Travis is quite short on resources and might not switch it
quickly enough.
2022-10-30 17:00:40 +00:00
Jakub Zelenka
1c5844aa3e
Fix GH-9754: SaltStack hangs when running php-fpm 8.1.11
SaltStack uses Python subprocess and redirects stderr to stdout which is
then piped to the returned output. If php-fpm starts in daemonized mode,
it should close stderr. However a fix introduced in GH-8913 keeps stderr
around so it can be later restored. That causes the issue reported in
GH-9754. The solution is to keep stderr around only when php-fpm runs in
foreground as the issue is most likely visible only there. Basically
there is no need to restore stderr when php-fpm is daemonized.
2022-10-30 11:41:33 +00:00
Kamil Tekiela
96049867d8
Add NEWS entry for #9841
Closes GH-9841
2022-10-27 18:29:17 +01:00
Kamil Tekiela
e713a8e8e5
Add a temporary fix for insufficient buffer size in mysqlnd (#9835) 2022-10-27 18:25:17 +01:00
Kamil Tekiela
5b60370906
mysqli_query throws warning despite using silenced error mode (#9842) 2022-10-27 18:24:28 +01:00
Remi Collet
db28ee8fd0
move CVEs in 8.0.25 changelog 2022-10-26 15:27:23 +02:00
Stanislav Malyshev
80ccaa3e36 Merge branch 'PHP-7.4' into PHP-8.0 2022-10-23 18:52:56 -06:00
Stanislav Malyshev
2669ed7d77 Update NEWS 2022-10-23 18:50:53 -06:00
Stanislav Malyshev
1d83a407d1 Merge branch 'PHP-7.4' into PHP-8.0 2022-10-23 18:49:21 -06:00