You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Found with AFL and Perl v5.25.4-20-gc2f7c0b*. I've attached the
non-minimized script because afl-tmin minimizes the crash away (again).
==26581==ERROR: AddressSanitizer: heap-buffer-overflow on address
0x619000009a80 at pc 0x000000ae54f7 bp 0x7ffc33c56be0 sp 0x7ffc33c56bd8
WRITE of size 8 at 0x619000009a80 thread T0
#0 0xae54f6 in Perl_pp_chdir /root/perl/pp_sys.c:3685:9 #1 0x7f1c63 in Perl_runops_debug /root/perl/dump.c:2234:23 #2 0x5a10a6 in S_run_body /root/perl/perl.c:2525:2 #3 0x5a10a6 in perl_run /root/perl/perl.c:2448 #4 0x4de6cd in main /root/perl/perlmain.c:123:9 #5 0x7f32be284b44 in __libc_start_main
/build/glibc-uPj9cH/glibc-2.19/csu/libc-start.c:287 #6 0x4de33c in _start (/root/perl/perl+0x4de33c)
0x619000009a80 is located 0 bytes to the right of 1024-byte region
[0x619000009680,0x619000009a80)
allocated by thread T0 here:
#0 0x4c0cbb in malloc (/root/perl/perl+0x4c0cbb) #1 0x7f5aa7 in Perl_safesysmalloc /root/perl/util.c:153:21
SUMMARY: AddressSanitizer: heap-buffer-overflow /root/perl/pp_sys.c:3685
Perl_pp_chdir
Shadow bytes around the buggy address:
0x0c327fff9300: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
0x0c327fff9310: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
0x0c327fff9320: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
0x0c327fff9330: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
0x0c327fff9340: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
=>0x0c327fff9350:[fa]fa fa fa fa fa fa fa fa fa fa fa fa fa fa fa
0x0c327fff9360: fa fa fa fa fa fa fa fa fa fa fa fa fa fa fa fa
0x0c327fff9370: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
0x0c327fff9380: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
0x0c327fff9390: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
0x0c327fff93a0: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
Shadow byte legend (one shadow byte represents 8 application bytes):
Addressable: 00
Partially addressable: 01 02 03 04 05 06 07
Heap left redzone: fa
Heap right redzone: fb
Freed heap region: fd
Stack left redzone: f1
Stack mid redzone: f2
Stack right redzone: f3
Stack partial redzone: f4
Stack after return: f5
Stack use after scope: f8
Global redzone: f9
Global init order: f6
Poisoned by user: f7
Container overflow: fc
ASan internal: fe
==26581==ABORTING
I don't think this would be exploitable beyond a denial of service if it
crashes perl - it only writes one pointersize beyond the end of the
allocated block, and is always the address of a new SV (should this use
PL_sv_yes and PL_sv_no?)
I don't think this would be exploitable beyond a denial of service if it
crashes perl - it only writes one pointersize beyond the end of the
allocated block, and is always the address of a new SV (should this use
PL_sv_yes and PL_sv_no?)
Activity
p5pRT commentedon Aug 29, 2016
From @geeknik
Found with AFL and Perl v5.25.4-20-gc2f7c0b*. I've attached the
non-minimized script because afl-tmin minimizes the crash away (again).
==26581==ERROR: AddressSanitizer: heap-buffer-overflow on address
0x619000009a80 at pc 0x000000ae54f7 bp 0x7ffc33c56be0 sp 0x7ffc33c56bd8
WRITE of size 8 at 0x619000009a80 thread T0
#0 0xae54f6 in Perl_pp_chdir /root/perl/pp_sys.c:3685:9
#1 0x7f1c63 in Perl_runops_debug /root/perl/dump.c:2234:23
#2 0x5a10a6 in S_run_body /root/perl/perl.c:2525:2
#3 0x5a10a6 in perl_run /root/perl/perl.c:2448
#4 0x4de6cd in main /root/perl/perlmain.c:123:9
#5 0x7f32be284b44 in __libc_start_main
/build/glibc-uPj9cH/glibc-2.19/csu/libc-start.c:287
#6 0x4de33c in _start (/root/perl/perl+0x4de33c)
0x619000009a80 is located 0 bytes to the right of 1024-byte region
[0x619000009680,0x619000009a80)
allocated by thread T0 here:
#0 0x4c0cbb in malloc (/root/perl/perl+0x4c0cbb)
#1 0x7f5aa7 in Perl_safesysmalloc /root/perl/util.c:153:21
SUMMARY: AddressSanitizer: heap-buffer-overflow /root/perl/pp_sys.c:3685
Perl_pp_chdir
Shadow bytes around the buggy address:
0x0c327fff9300: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
0x0c327fff9310: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
0x0c327fff9320: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
0x0c327fff9330: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
0x0c327fff9340: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
=>0x0c327fff9350:[fa]fa fa fa fa fa fa fa fa fa fa fa fa fa fa fa
0x0c327fff9360: fa fa fa fa fa fa fa fa fa fa fa fa fa fa fa fa
0x0c327fff9370: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
0x0c327fff9380: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
0x0c327fff9390: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
0x0c327fff93a0: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
Shadow byte legend (one shadow byte represents 8 application bytes):
Addressable: 00
Partially addressable: 01 02 03 04 05 06 07
Heap left redzone: fa
Heap right redzone: fb
Freed heap region: fd
Stack left redzone: f1
Stack mid redzone: f2
Stack right redzone: f3
Stack partial redzone: f4
Stack after return: f5
Stack use after scope: f8
Global redzone: f9
Global init order: f6
Poisoned by user: f7
Container overflow: fc
ASan internal: fe
==26581==ABORTING
p5pRT commentedon Aug 29, 2016
From @geeknik
crash330.gz
p5pRT commentedon Sep 5, 2016
From @tonycoz
On Mon Aug 29 13:54:26 2016, brian.carpenter@gmail.com wrote:
chdir() isn't allocating stack for its result when called with no argument.
Most other ops default to $_ and are compiled that way, for example:
tony@mars:.../git/perl$ ./perl -Ilib -MO=Concise -e sin
5 <@> leave[1 ref] vKP/REFC ->(end)
1 <0> enter ->2
2 <;> nextstate(main 1 -e:1) v:{ ->3
4 <1> sin[t2] vK/1 ->5
- <1> ex-rv2sv sK/1 ->4
3 <$> gvsv(*_) s ->4
chdir() doesn't get that faked argument:
tony@mars:.../git/perl$ ./perl -Ilib -MO=Concise -e chdir
4 <@> leave[1 ref] vKP/REFC ->(end)
1 <0> enter ->2
2 <;> nextstate(main 1 -e:1) v:{ ->3
3 <0> chdir[t1] v ->4
since chdir() with no argument has it's own special behaviour.
A simpler reproducer:
for $x (map $_+1, 1 .. 100) {
map chdir, 1 .. $x;
}
Fix attached.
I don't think this would be exploitable beyond a denial of service if it
crashes perl - it only writes one pointersize beyond the end of the
allocated block, and is always the address of a new SV (should this use
PL_sv_yes and PL_sv_no?)
Tony
p5pRT commentedon Sep 5, 2016
From @tonycoz
0001-perl-129130-make-chdir-allocate-the-stack-it-needs.patch
p5pRT commentedon Sep 5, 2016
The RT System itself - Status changed from 'new' to 'open'
p5pRT commentedon Oct 24, 2016
From @tonycoz
On Sun Sep 04 22:50:16 2016, tonyc wrote:
Applied as 92c843f.
And made this public.
Tony
p5pRT commentedon Dec 6, 2017
From zefram@fysh.org
This bug was fixed by Tony's patch. This ticket should be closed.
-zefram
p5pRT commentedon Dec 7, 2017
@cpansprout - Status changed from 'open' to 'resolved'