Skip to content

t1disasm: buffer overflow in set_cs_start #4

Closed
@nthykier

Description

We received the following report in Debian (https://bugs.debian.org/779274). I have not had time to look at it in details. However, given it was public and it is believed to allow code execution via a crafted file, I decided to forward it immediately.

"""
$ t1asm crash.raw crash.pfb
t1asm: warning: no charstrings found in input file

$ t1disasm crash.pfb /dev/null
Segmentation fault

Backtrace:
#0 ___fprintf_chk (fp=0x6f6f6f6f, flag=1, format=0x804eedc "%.*s") at fprintf_chk.c:30
#1 0x0804d653 in fprintf (__fmt=0x804eedc "%.*s", __stream=) at /usr/include/i386-linux-gnu/bits/stdio2.h:97
#2 eexec_line (line=0xffffd320 "/m", 'o' <repeats 36 times>, "{string currentfile exch readstring pop}executeonly def\n", line_len=, line_len@entry=94) at t1disasm.c:462
#3 0x0804e05e in disasm_output_binary (data=0xffffd320 "/m", 'o' <repeats 36 times>, "{string currentfile exch readstring pop}executeonly def\n", len=94) at t1disasm.c:595
#4 0x0804cf67 in process_pfb (ifp=0x80531c0, ifp_filename=0xffffd9ff "crash.pfb", fr=0xffffd760) at t1lib.c:295
#5 0x08048f41 in main (argc=3, argv=0xffffd834) at t1disasm.c:770

This happened because set_cs_start overwrote the file pointer with data from the disassembled file.

I believe the bug can be exploited for code execution, at least on systems that don't have executable space protection.

This bug was found using American fuzzy lop:
http://lcamtuf.coredump.cx/afl/
"""

The file contents of crash.raw:

currentfile eexec
/moooooooooooooooooooooooooooooooooooo{string currentfile exch readstring pop}executeonly def

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions