Branch: refs/heads/blead
  Home:   https://github.com/Perl/perl5
  Commit: ff1f9f59360afeebd6f75ca1502f5c3ebf077da3
      
https://github.com/Perl/perl5/commit/ff1f9f59360afeebd6f75ca1502f5c3ebf077da3
  Author: Karl Williamson <k...@cpan.org>
  Date:   2023-11-26 (Sun, 26 Nov 2023)

  Changed paths:
    M regcomp.c
    M t/re/pat_advanced.t

  Log Message:
  -----------
  Fix read/write past buffer end: perl-security#140

A package name may be specified in a \p{...} regular expression
construct.  If unspecified, "utf8::" is assumed, which is the package
all official Unicode properties are in.  By specifying a different
package, one can create a user-defined property with the same
unqualified name as a Unicode one.  Such a property is defined by a sub
whose name begins with "Is" or "In", and if the sub wishes to refer to
an official Unicode property, it must explicitly specify the "utf8::".
S_parse_uniprop_string() is used to parse the interior of both \p{} and
the user-defined sub lines.

In S_parse_uniprop_string(), it parses the input "name" parameter,
creating a modified copy, "lookup_name", malloc'ed with the same size as
"name".  The modifications are essentially to create a canonicalized
version of the input, with such things as extraneous white-space
stripped off.  I found it convenient to strip off the package specifier
"utf8::".  To to so, the code simply pretends "lookup_name" begins just
after the "utf8::", and adjusts various other values to compensate.
However, it missed the adjustment of one required one.

This is only a problem when the property name begins with "perl" and
isn't "perlspace" nor "perlword".  All such ones are undocumented
internal properties.

What happens in this case is that the input is reparsed with slightly
different rules in effect as to what is legal versus illegal.  The
problem is that "lookup_name" no longer is pointing to its initial
value, but "name" is.  Thus the space allocated for filling "lookup_name"
is now shorter than "name", and as this shortened "lookup_name" is
filled by copying suitable portions of "name", the write can be to
unallocated space.

The solution is to skip the "utf8::" when reparsing "name".  Then both
"lookup_name" and "name" are effectively shortened by the same amount,
and there is no going off the end.

This commit also does white-space adjustment so that things align
vertically for readability.

This can be easily backported to earlier Perl releases.


  Commit: 906e92715f4ee68ea95086867f4f97b1f4f10ac3
      
https://github.com/Perl/perl5/commit/906e92715f4ee68ea95086867f4f97b1f4f10ac3
  Author: Tony Cook <t...@develop-help.com>
  Date:   2023-11-26 (Sun, 26 Nov 2023)

  Changed paths:
    M t/win32/system.t
    M win32/win32.c

  Log Message:
  -----------
  win32: default the shell to cmd.exe in the Windows system directory

This prevents picking up cmd.exe from the current directory, or
even from the PATH.

This protects against a privilege escalation attack where an attacker
in a separate session creates a cmd.exe in a directory where the
target account happens to have its current directory.


Compare: https://github.com/Perl/perl5/compare/f64eb1530947...906e92715f4e

Reply via email to