# # ronin-exploits - A Ruby library for ronin-rb that provides exploitation and # payload crafting functionality. # # Copyright (c) 2007-2022 Hal Brodigan (postmodern.mod3 at gmail.com) # # ronin-exploits is free software: you can redistribute it and/or modify # it under the terms of the GNU Lesser General Public License as published # by the Free Software Foundation, either version 3 of the License, or # (at your option) any later version. # # ronin-exploits is distributed in the hope that it will be useful, # but WITHOUT ANY WARRANTY; without even the implied warranty of # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the # GNU Lesser General Public License for more details. # # You should have received a copy of the GNU Lesser General Public License # along with ronin-exploits. If not, see . # require 'ronin/exploits/web_vuln' require 'ronin/exploits/mixins/has_payload' require 'ronin/vulns/rfi' require 'ronin/payloads/url_payload' module Ronin module Exploits # # Represents a [Remote File Inclusion (RFI)][RFI] exploit. # # [RFI]: https://owasp.org/www-project-web-security-testing-guide/v42/4-Web_Application_Security_Testing/07-Input_Validation_Testing/11.2-Testing_for_Remote_File_Inclusion # # ## Example # # require 'ronin/exploits/rfi' # # module Ronin # module Exploits # class MyExploit < RFI # # register 'my_exploit' # # base_path '/path/to/page.php' # query_param 'template' # # end # end # end # # @api public # # @since 1.0.0 # class RFI < WebVuln include Mixins::HasPayload payload_class Payloads::URLPayload references [ 'https://owasp.org/www-project-web-security-testing-guide/v42/4-Web_Application_Security_Testing/07-Input_Validation_Testing/11.2-Testing_for_Remote_File_Inclusion' ] param :test_script_url, String, desc: 'The URL for the RFI test script' param :filter_bypass, Enum[:null_byte, :double_encode], desc: 'Optional filter bypass strategy' # # Returns the type or kind of exploit. # # @return [Symbol] # # @note # This is used internally to map an exploit class to a printable type. # # @api private # def self.exploit_type :rfi end # # The RFI vulnerability to exploit. # # @return [Ronin::Vulns::RFI] # def vuln @vuln ||= Vulns::RFI.new( url, test_script_url: params[:test_script_url], filter_bypass: params[:filter_bypass], **web_vuln_kwargs ) end # # Launches the RFI exploit with the payload. # def launch vuln.exploit(@payload) end end end end