0x00 前言
RubyEncoder 是一款对 Ruby 代码进行混淆加密的软件,因为最近我要破解某个使用 RubyEncoder 加密的 Ruby 程序, 所以工作就转移到如何解密 RubyEncoder 加密的程序。
0x01 信息收集
要想了解 RubyEncoder,那肯定是要去官网下载一份试用版,但是无论你怎么填写试用资料:
我隐约记得 Hacking Team RCS 也用了 RubyEncoder,所以比较幸运的, 我从 Hacking Team 邮件 中找到了一个可以登陆账号密码:
Username: alor@hackingteam.it
Password: Oyf4GSy0
下载到了 RubyEncoder-2.3,并偷偷的使用 Hacking Team 一个 License Key 成功激活了 RubyEncoder
先简单试用一下 RubyEncoder
上图是 RubyEncoder 对某个项目加密的主界面,在这个界面中可以看到,我们可以选择支持的 Ruby 版本。 由于因为可以选多个版本号以及 1.8.x 也在支持的版本内,所以可以判定加密后的文件不会是 iseq 或者修改后的 iseq。
图是 RubyEncoder 支持的加密选项,可以进行 IP、Domain、MAC、联网、时间、License 限制。其中除了 License 文件之外,其他都是纸老虎, 如果 License 文件没有参与对文件的加密,那 License 限制也是纸老虎。不过根据官方文档描述
The algorithm uses an idea of two keys. The first key (Project Id) is stored in the encrypted area of the protected script and is used to decrypt an external license file. The second key (Project Key) is stored in the license file and it is used to decrypt the bytecode from the protected script.
所以如果没有 License 文件是很难将程序跑起来的,不过这篇文章的目的不是怎么样解除这些限制,而是如何解密 RubyEncoder 加密后的 Ruby 代码。
我们再来看一下 RubyEncoder 的目录结构:
.
├── Loaders
│ ├── Linux
│ │ ├