
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 कोड बिना दूरस्थ कोड निष्पादन के ही विशेषाधिकारों को एडमिन खाते तक बढ़ा देता है।
कुकी का मान कॉपी करें और इसे पंक्ति 11 पर "VALUE_OF_THE_COOKIE" से बदलें:
cookie = CGI.unescape "VALUE_OF_THE_COOKIE" # put in the value of your cookie here
इसके अलावा, "NAME::Application" को अपने एप्लिकेशन के नाम से बदलें। उदाहरण के लिए, यदि एप्लिकेशन का नाम "test" है, तो यह "test::Application" होगा:
secret = Digest::MD5.hexdigest("NAME::Application") # the name of the ruby on rails application, either bruteforce or have to be known directly
एक्सप्लॉइट चलाएं और कुकी के आउटपुट को कॉपी करें। इसे वेब एप्लिकेशन की कुकी से बदलें:
ruby CVE-2019-5420.rb