I set inherit to pass to const_get to false and restricted lookup just in case.
If there are no restrictions, you can specify a top-level class, so the client can craft the request to specify the Tempfile orLogger class.
Under ruby2.5, command injection is possible with Logger.new("|date"),
If specify | at the beginning of the request path, an error will occur, so it does not seem to be RCE.
$ telnet 127.0.0.1 9292
Trying 127.0.0.1...
Connected to localhost.
Escape character is '^]'.
LOGGER |date HTTP/1.1
HTTP/1.1 400 Bad Request
Connection closed by foreign host.
I set inherit to pass to const_get to
false
and restricted lookup just in case. If there are no restrictions, you can specify a top-level class, so the client can craft the request to specify theTempfile
orLogger
class.Under ruby2.5, command injection is possible with
Logger.new("|date")
, If specify|
at the beginning of the request path, an error will occur, so it does not seem to be RCE.