For an explanation on how these work in python, I recommend checking out this writeup. Essentially, it made me wonder if you could do the same thing in ruby, and you definitely can (at least the accessing other methods part). No pwnz yet from me (though I can’t be the first to think of this, so it may be a nothingburger, or just a cool trick)
How it works
In ruby, you would start by delcaring a string:
somestring = "a string";
This would create an object from the String class. Thus, it would have access to all the methods of the String class. It also has some ancestor classes. You can access these like so:
somestring = "a string";
puts somestring.class.ancestors;
When you run that, you should see the output:
String
Comparable
Object
Kernel
BasicObject
This is an array of ancestor methods/classes of the String class. Thus, you can access them by index!
somestring = "a string";
puts somestring.class.ancestors[3];
When you run that, you should see the output:
Kernel
We are now accessing the Kernel module, which has some pretty interesting methods… The most interesting to me is the system method. Using this method, you can execute arbitrary shell commands.
somestring = "a string";
somestring.class.ancestors[3].system("cat /etc/passwd");
PoC
So, just a fun learning experience for me on how you can access things in unique ways in Ruby!
Overview
I recently noticed quite a few folks recently looked at Nagios XI. Some even pulled the obfuscated stuff apart which I thought was really awesome! I...
Path traversal in File Upload leads to Remote Code Execution in Chamilo LMS
Overview
It’s been a bit since I spent some time looking for a web vuln… And this...
tldr/oneliner
ruby -e '"".class.ancestors[3].system("cat /etc/passwd")'
Why?
So I was doing a bit of reading on SSTI, specifically that of Jinja/python which...
TL;DR
Just go to the Demo
Or, just go to the Demo Round 2 for reverse tunneling
Accessing Resources Behind Multiple Resources
At some point, you may run into...
How to get a Shell on your Router (hopefully)
Vulnerability hunting is hard, and it’s even harder if you don’t have access to the source. Hardware devices ma...