Exploit database

GH-7157d8586562e710281f1978960998eb

theman001/cve-2025-55182_poc-test-server

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 files3
theman001/cve-2025-55182_poc-test-serverRevision 45caec231250

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

setup.sh

Shell · 10,095 bytes
#!/bin/bash

echo "🚧 CVE-2025-55182 — Next.js 15 React2Shell PoC 자동 구축 시작..."

APP_DIR="vuln-react2shell"
PM2_PROCESS_NAME="react2shell"

# Node, npm, pm2 확인
for cmd in node npm pm2; do
  if ! command -v $cmd &>/dev/null; then
    echo "❌ '$cmd' 명령이 없습니다. 설치 후 다시 실행하세요."
    exit 1
  fi
done

# 디렉토리 생성
mkdir -p "$APP_DIR/app/formaction" \
         "$APP_DIR/app/ui/test" \
         "$APP_DIR/app/ui/log"  \
         "$APP_DIR/app/ui/diff" \
         "$APP_DIR/app/ui/packet"

cd "$APP_DIR" || exit 1

#############################################
# package.json — 취약 조합
#############################################
cat <<EOF > package.json
{
  "name": "react2shell",
  "version": "1.0.0",
  "private": true,
  "scripts": {
    "dev": "next dev -p 3000",
    "build": "next build",
    "start": "next start -p 3000"
  },
  "dependencies": {
    "next": "15.1.0",
    "react": "19.0.0",
    "react-dom": "19.0.0",
    "react-server-dom-webpack": "19.0.0"
  }
}
EOF


#############################################
# next.config.js — Next.js 15 취약 환경 유지
#############################################
cat <<EOF > next.config.js
module.exports = {
  experimental: {
    serverActions: true,
    serverComponentsExternalPackages: ["child_process", "fs", "vm", "module"]
  },
  reactStrictMode: false
};
EOF


#############################################
# layout.js — 기본 레이아웃
#############################################
cat <<EOF > app/layout.js
export default function RootLayout({ children }) {
  return (
    <html>
      <body style={{ padding: "20px", fontFamily: "monospace", background: "#f9f9f9" }}>
        {children}
      </body>
    </html>
  );
}
EOF


#############################################
# 메인 페이지
#############################################
cat <<EOF > app/page.js
import Link from "next/link";

export default function Home() {
  const menu = [
    { name: "📨 Form Submit Test", url: "/ui/test", desc: "multipart/form-data 기반 요청 테스트" },
    { name: "📄 FormAction Logger", url: "/ui/log", desc: "최근 전송된 FormData 확인" },
    { name: "🔍 Response Diff Analyzer", url: "/ui/diff", desc: "action_id 기반 응답 분석" },
    { name: "🛰 HTTP Packet Builder", url: "/ui/packet", desc: "HTTP 요청 직접 생성 및 전송" }
  ];

  return (
    <div style={{ padding: "20px", fontFamily: "monospace" }}>
      <h1>🔬 CVE-2025-55182 — React2Shell PoC 서버</h1>
      <p>아래 메뉴에서 기능을 선택하세요.</p>

      <div
        style={{
          display: "grid",
          gridTemplateColumns: "repeat(auto-fit, minmax(280px, 1fr))",
          gap: "20px",
          marginTop: "20px"
        }}
      >
        {menu.map(item => (
          <Link
            key={item.url}
            href={item.url}
            style={{
              padding: "18px",
              border: "1px solid #ccc",
              borderRadius: "10px",
              background: "#fafafa",
              textDecoration: "none",
              color: "#222",
              display: "block"
            }}
          >
            <div style={{ fontSize: "18px", marginBottom: "8px" }}>{item.name}</div>
            <div style={{ fontSize: "13px", color: "#666" }}>{item.desc}</div>
          </Link>
        ))}
      </div>
    </div>
  );
}
EOF


#############################################
# FormAction 취약 라우트 (원본 복구)
#############################################
cat <<EOF > app/formaction/route.js
import { unstable_decodeAction } from "react-server-dom-webpack/server";

let lastPayload = null;

export async function POST(req) {
  const contentType = req.headers.get("content-type") || "";
  let formDataDump = {};

  if (contentType.includes("multipart/form-data")) {
    const form = await req.formData();
    formDataDump = Object.fromEntries(form.entries());
    lastPayload = formDataDump;

    if (formDataDump.action_id) {
      try {
        const decoded = await unstable_decodeAction(formDataDump.action_id);
        return Response.json({ decoded });
      } catch (err) {
        return Response.json({ error: String(err) });
      }
    }
  }

  return Response.json({ formDataDump });
}

export function GET() {
  return Response.json(lastPayload ?? { msg: "No request yet" });
}
EOF


#############################################
# UI: Packet Builder (Direct Fetch)
#############################################
cat <<EOF > app/ui/packet/page.js
"use client";

import { useState } from "react";

export default function PacketBuilder() {
  const [method, setMethod] = useState("GET");
  const [uri, setUri] = useState("/");
  const [bodyMode, setBodyMode] = useState("raw");
  const [rawBody, setRawBody] = useState("");
  const [jsonBody, setJsonBody] = useState("{}");
  const [formItems, setFormItems] = useState([{ key: "", value: "" }]);
  const [responseOut, setResponseOut] = useState("");

  const BASE_URL = "http://web.taeuk.o-r.kr";

  function addFormField() {
    setFormItems([...formItems, { key: "", value: "" }]);
  }

  function updateFormField(i, field, value) {
    const updated = [...formItems];
    updated[i][field] = value;
    setFormItems(updated);
  }

  async function sendRequest() {
    const targetUrl = BASE_URL + uri;
    let options = { method, headers: {} };

    if (method !== "GET" && method !== "HEAD") {
      if (bodyMode === "raw") {
        options.headers["Content-Type"] = "text/plain";
        options.body = rawBody;

      } else if (bodyMode === "json") {
        options.headers["Content-Type"] = "application/json";
        try {
          options.body = JSON.stringify(JSON.parse(jsonBody));
        } catch (err) {
          setResponseOut("❌ JSON Parse Error: " + String(err));
          return;
        }

      } else if (bodyMode === "form") {
        const form = new FormData();
        for (const item of formItems) {
          if (item.key.trim()) form.append(item.key, item.value);
        }
        options.body = form;
      }
    }

    try {
      const res = await fetch(targetUrl, options);
      const text = await res.text();

      setResponseOut(
        JSON.stringify(
          {
            request: { url: targetUrl, method, bodyMode },
            response: { status: res.status, statusText: res.statusText, body: text }
          },
          null,
          2
        )
      );
    } catch (err) {
      setResponseOut("❌ Fetch Error: " + String(err));
    }
  }

  return (
    <div style={{ display: "flex", gap:"20px" }}>
      <div style={{ width:"50%", background:"#fafafa", padding:"20px", borderRadius:"10px" }}>
        <h2>🛰 HTTP Packet Builder</h2>

        <label>HTTP Method</label><br/>
        <select value={method} onChange={e => setMethod(e.target.value)}>
          <option>GET</option><option>POST</option><option>PUT</option>
          <option>DELETE</option><option>PATCH</option>
          <option>OPTIONS</option><option>HEAD</option>
        </select>

        <br/><br/>
        <label>URI</label><br/>
        <input style={{ width:"100%" }} value={uri} onChange={e => setUri(e.target.value)} />

        <br/><br/>
        <label>Body Mode</label><br/>
        <select value={bodyMode} onChange={e => setBodyMode(e.target.value)}>
          <option value="raw">Raw Body</option>
          <option value="json">JSON</option>
          <option value="form">Form-Data</option>
        </select>

        {bodyMode === "raw" && (
          <>
            <br/><br/><label>Raw Body</label>
            <textarea style={{ width:"100%", height:"100px" }}
              value={rawBody} onChange={e => setRawBody(e.target.value)} />
          </>
        )}

        {bodyMode === "json" && (
          <>
            <br/><br/><label>JSON Body</label>
            <textarea style={{ width:"100%", height:"100px" }}
              value={jsonBody} onChange={e => setJsonBody(e.target.value)} />
          </>
        )}

        {bodyMode === "form" && (
          <>
            <br/><br/><label>Form-Data Fields</label>
            {formItems.map((item, i) => (
              <div key={i} style={{ display:"flex", gap:"10px", marginTop:"5px" }}>
                <input
                  placeholder="key" value={item.key}
                  onChange={e => updateFormField(i, "key", e.target.value)}
                  style={{ flex:"1" }}
                />
                <input
                  placeholder="value" value={item.value}
                  onChange={e => updateFormField(i, "value", e.target.value)}
                  style={{ flex:"2" }}
                />
              </div>
            ))}
            <button style={{ marginTop:"10px" }} onClick={addFormField}>+ Add Field</button>
          </>
        )}

        <br/><br/>
        <button onClick={sendRequest} style={{ padding:"10px 20px" }}>📨 Send Request</button>
      </div>

      <div style={{
        width:"50%", background:"#fff", padding:"20px",
        borderRadius:"10px", border:"1px solid #ccc"
      }}>
        <h2>📥 Response</h2>
        <pre style={{ whiteSpace:"pre-wrap", background:"#eee", padding:"10px" }}>
          {responseOut}
        </pre>
      </div>
    </div>
  );
}
EOF


#############################################
# README
#############################################
cat <<EOF > README.md
# CVE-2025-55182 — React2Shell PoC + Packet Builder (Direct-Fetch Edition)

- FormAction 취약점 재현
- Response Diff 분석
- FormAction Logger
- Packet Builder (브라우저 직접 HTTP 요청)
- RSC + react-server-dom-webpack 환경과 완전 호환
EOF


#############################################
# 설치 및 실행
#############################################
echo "📦 npm install 실행 중..."
npm install

echo "🚀 PM2 dev 서버 실행 중..."
pm2 start npm --name "$PM2_PROCESS_NAME" -- run dev
pm2 save

echo "🎉 PoC + Packet Builder 서버 구축 완료!"
echo "🌐 http://localhost:3000"
echo "🌐 http://web.taeuk.o-r.kr:3000"