Explorar o código

The shell escaping fix in map_yp_alias (CVE-2009-1579) was incomplete.
Thanks Michal Hlavinka for noticing this. [CVE-2009-1381]

Thijs Kinkhorst %!s(int64=16) %!d(string=hai) anos
pai
achega
6f1f3d6b35
Modificáronse 2 ficheiros con 4 adicións e 2 borrados
  1. 2 1
      doc/ChangeLog
  2. 2 1
      functions/imap_general.php

+ 2 - 1
doc/ChangeLog

@@ -304,7 +304,8 @@ Version 1.5.2 - SVN
     also includes general cleanup of that page (Thanks to Niels Teusink).
     also includes general cleanup of that page (Thanks to Niels Teusink).
     [also CVE-2009-1578]
     [also CVE-2009-1578]
   - Fixed unsanitized shell command in example IMAP username mapping
   - Fixed unsanitized shell command in example IMAP username mapping
-    function (map_yp_alias) (Thanks to Niels Teusink). [CVE-2009-1579]
+    function (map_yp_alias) (Thanks to Niels Teusink).
+    [CVE-2009-1579, CVE-2009-1381]
   - Fixed session fixation issues where someone who can modify a user's
   - Fixed session fixation issues where someone who can modify a user's
     cookies could gain control of their login session.  The SquirrelMail
     cookies could gain control of their login session.  The SquirrelMail
     base URI is now uniformly generated, extraneous cookies are cleaned
     base URI is now uniformly generated, extraneous cookies are cleaned

+ 2 - 1
functions/imap_general.php

@@ -1436,6 +1436,7 @@ function sqimap_get_user_server ($imap_server, $username) {
  * @since 1.3.0
  * @since 1.3.0
  */
  */
 function map_yp_alias($username) {
 function map_yp_alias($username) {
-   $yp = `ypmatch ' . escapeshellarg($username) . ' aliases`;
+   $safe_username = escapeshellarg($username);
+   $yp = `ypmatch $safe_username aliases`;
    return chop(substr($yp, strlen($username)+1));
    return chop(substr($yp, strlen($username)+1));
 }
 }