
Exploit in Rails Development Mode. With some knowledge of a target application it is possible for an attacker to guess the automatically generated development mode secret token. This secret token can be used in combination with other Rails internals to escalate to a remote code execution exploit.
在开发模式下的 Rails <5.2.2.1, <6.0.0.beta3 中存在一个远程代码执行漏洞,攻击者可以猜测自动生成的开发模式密钥令牌。该密钥令牌可与 Rails 内部机制结合使用,升级为远程代码执行漏洞。此 CVE-2019-5420 PoC 代码将权限提升为管理员账户,而无需实际执行远程代码。
复制 cookie 的值,并将其替换到第 11 行的 "VALUE_OF_THE_COOKIE" 处:
cookie = CGI.unescape "VALUE_OF_THE_COOKIE" # 在此处放入你的 cookie 值
此外,将 "NAME::Application" 替换为你的应用程序名称。例如,如果应用程序名称为 "test",则应为 "test::Application":
secret = Digest::MD5.hexdigest("NAME::Application") # Ruby on Rails 应用程序的名称,要么暴力破解,要么必须直接知道
运行漏洞利用程序,并复制输出的 cookie。将其替换为 Web 应用程序的 cookie:
ruby CVE-2019-5420.rb