Exploit database

GH-771acfc4fe352e3ff06b2b9a4a3e7442

m0d0ri205/wargame_re-ls

GitHubNot listedPoC
Download repository ZIP

Sources for CVE-2025-0184

1 source

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

Repository files1
m0d0ri205/wargame_re-lsRevision 01ec1bc12421

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

templates/index.html

HTML · 21,073 bytes
<!DOCTYPE html>
<html lang="ko">
<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>📄 DOCX Knowledge Extractor - CVE-2025-0184</title>
    <style>
        * {
            margin: 0;
            padding: 0;
            box-sizing: border-box;
        }

        body {
            font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
            background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
            min-height: 100vh;
            color: #333;
        }

        .container {
            max-width: 900px;
            margin: 0 auto;
            padding: 20px;
        }

        .header {
            text-align: center;
            color: white;
            margin-bottom: 30px;
        }

        .header h1 {
            font-size: 2.5em;
            margin-bottom: 10px;
            text-shadow: 2px 2px 4px rgba(0,0,0,0.3);
        }

        .header p {
            font-size: 1.2em;
            opacity: 0.9;
        }

        .main-card {
            background: white;
            border-radius: 15px;
            padding: 40px;
            box-shadow: 0 10px 30px rgba(0,0,0,0.2);
            margin-bottom: 30px;
        }

        .upload-area {
            border: 3px dashed #007bff;
            border-radius: 10px;
            padding: 50px 20px;
            text-align: center;
            margin: 30px 0;
            transition: all 0.3s ease;
            cursor: pointer;
        }

        .upload-area:hover {
            border-color: #0056b3;
            background: #f8f9fa;
        }

        .upload-area.dragover {
            border-color: #28a745;
            background: #d4edda;
        }

        .file-input {
            display: none;
        }

        .upload-btn {
            background: #007bff;
            color: white;
            border: none;
            padding: 15px 30px;
            border-radius: 8px;
            font-size: 1.1em;
            cursor: pointer;
            transition: background 0.3s ease;
            margin: 20px 10px;
        }

        .upload-btn:hover {
            background: #0056b3;
        }

        .upload-btn:disabled {
            background: #6c757d;
            cursor: not-allowed;
        }

        .auth-section {
            background: #fff3cd;
            border: 2px solid #ffc107;
            border-radius: 10px;
            padding: 25px;
            margin: 20px 0;
        }

        .auth-input {
            width: 100%;
            padding: 12px;
            border: 2px solid #ddd;
            border-radius: 6px;
            font-size: 1em;
            margin: 10px 0;
            font-family: 'Courier New', monospace;
        }

        .auth-input:focus {
            outline: none;
            border-color: #007bff;
            box-shadow: 0 0 5px rgba(0,123,255,0.3);
        }

        .auth-buttons {
            display: flex;
            gap: 10px;
            flex-wrap: wrap;
            margin: 15px 0;
        }

        .auth-btn {
            background: #28a745;
            color: white;
            border: none;
            padding: 8px 16px;
            border-radius: 5px;
            font-size: 0.9em;
            cursor: pointer;
            transition: background 0.3s ease;
        }

        .auth-btn:hover {
            background: #218838;
        }

        .auth-status {
            padding: 10px;
            border-radius: 5px;
            margin: 10px 0;
            font-weight: bold;
        }

        .auth-success {
            background: #d4edda;
            color: #155724;
            border: 1px solid #c3e6cb;
        }

        .auth-error {
            background: #f8d7da;
            color: #721c24;
            border: 1px solid #f5c6cb;
        }

        .results-section {
            margin-top: 30px;
            display: none;
        }

        .result-item {
            background: #f8f9fa;
            border-left: 4px solid #007bff;
            padding: 20px;
            margin: 15px 0;
            border-radius: 0 8px 8px 0;
        }

        .result-success {
            border-left-color: #28a745;
            background: #d4edda;
        }

        .result-error {
            border-left-color: #dc3545;
            background: #f8d7da;
        }

        .result-flag {
            border-left-color: #ffc107;
            background: #fff3cd;
            animation: pulse 2s infinite;
        }

        @keyframes pulse {
            0% { transform: scale(1); }
            50% { transform: scale(1.02); }
            100% { transform: scale(1); }
        }

        .code-block {
            background: #2d3748;
            color: #e2e8f0;
            padding: 15px;
            border-radius: 6px;
            font-family: 'Courier New', monospace;
            overflow-x: auto;
            margin: 10px 0;
        }

        .info-panel {
            background: #e3f2fd;
            border: 1px solid #2196f3;
            border-radius: 8px;
            padding: 20px;
            margin: 20px 0;
        }

        .loading {
            display: none;
            text-align: center;
            padding: 20px;
        }

        .spinner {
            border: 4px solid #f3f3f3;
            border-top: 4px solid #007bff;
            border-radius: 50%;
            width: 40px;
            height: 40px;
            animation: spin 1s linear infinite;
            margin: 0 auto 15px;
        }

        @keyframes spin {
            0% { transform: rotate(0deg); }
            100% { transform: rotate(360deg); }
        }

        .debug-info {
            background: #f8f9fa;
            border: 1px solid #dee2e6;
            border-radius: 6px;
            padding: 15px;
            margin: 20px 0;
            font-size: 0.9em;
        }

        .hint-box {
            background: #fff3cd;
            border: 1px solid #ffc107;
            border-radius: 6px;
            padding: 15px;
            margin: 20px 0;
        }

        .footer {
            text-align: center;
            color: white;
            opacity: 0.8;
            margin-top: 40px;
        }

        .status-badge {
            display: inline-block;
            padding: 4px 8px;
            border-radius: 4px;
            font-size: 0.8em;
            font-weight: bold;
            margin-left: 10px;
        }

        .badge-success { background: #28a745; color: white; }
        .badge-error { background: #dc3545; color: white; }
        .badge-warning { background: #ffc107; color: #212529; }
    </style>
</head>
<body>
    <div class="container">
        <div class="header">
            <h1>📄 DOCX Knowledge Extractor</h1>
            <p>Upload DOCX files to extract knowledge and external references</p>
            <small>CVE-2025-0184 Challenge Environment - Authentication Required</small>
        </div>

        <div class="main-card">
            <h2>🔐 Authentication Required</h2>
            <p>Please enter a valid hash key to authenticate file upload access.</p>
            
            <div class="auth-section">
                <h4>🔑 Hash Key Authentication</h4>
                <input type="text" id="hashKeyInput" class="auth-input" 
                       placeholder="Enter hash key..." 
                       autocomplete="off">
                
                <div class="auth-buttons">
                    <button type="button" class="auth-btn" onclick="validateHashKey()">
                        ✅ Validate Key
                    </button>
                </div>
                
                <div id="authStatus"></div>
            </div>
        </div>

        <div class="main-card" id="uploadSection" style="display: none;">
            <h2>📤 File Upload</h2>
            <p>Upload a DOCX file to analyze its external relationships and extract referenced content.</p>
            
            <form id="uploadForm" enctype="multipart/form-data">
                <div class="upload-area" id="uploadArea">
                    <div>
                        <h3>📁 Drop DOCX file here or click to browse</h3>
                        <p>Maximum file size: 16MB</p>
                        <input type="file" id="docxFile" name="docx_file" accept=".docx" class="file-input">
                        <input type="hidden" id="hashKey" name="hash_key">
                        <input type="hidden" id="timestamp" name="timestamp">
                        <button type="button" class="upload-btn" onclick="document.getElementById('docxFile').click()">
                            📁 Choose File
                        </button>
                        <button type="submit" class="upload-btn" id="processBtn" disabled>
                            🚀 Process DOCX
                        </button>
                    </div>
                </div>
            </form>

            <div class="loading" id="loading">
                <div class="spinner"></div>
                <p>Processing DOCX file and extracting relationships...</p>
            </div>

            <div class="results-section" id="resultsSection">
                <h3>📊 Processing Results</h3>
                <div id="resultsContainer"></div>
            </div>
        </div>

        <div class="main-card">
            <h2>💡 Information & Hints</h2>
            
            <div class="info-panel">
                <h4>🔍 What this tool does:</h4>
                <ul style="margin: 10px 0 0 20px; line-height: 1.6;">
                    <li>Extracts external relationships from DOCX files</li>
                    <li>Analyzes _rels/*.rels XML files within the DOCX structure</li>
                    <li>Makes HTTP requests to external URLs found in relationships</li>
                    <li>Returns the response content for analysis</li>
                    <li><strong>Requires hash key authentication before file upload</strong></li>
                </ul>
            </div>

            <div class="hint-box">
                <h4>💡 CTF Hints:</h4>
                <ul style="margin: 10px 0 0 20px; line-height: 1.6;">
                    <li>DOCX files are actually ZIP archives containing XML files</li>
                    <li>External relationships can reference any URL</li>
                    <li>Internal services might be running on various ports</li>
                    <li>Some security filters might be bypassable</li>
                    <li>Hash key authentication uses a fixed key value</li>
                    <li>Check the <code>/debug</code> endpoint for more information</li>
                </ul>
            </div>

            <div class="debug-info">
                <h4>🛠️ Debug Information</h4>
                <button class="upload-btn" onclick="loadDebugInfo()">🔍 Load Debug Info</button>
                <div id="debugInfo"></div>
            </div>
        </div>

        <div class="footer">
            <p>CVE-2025-0184 DOCX SSRF Challenge with Hash Authentication</p>
            <p>Based on real vulnerability in langgenius/dify</p>
        </div>
    </div>

    <script>
        const uploadArea = document.getElementById('uploadArea');
        const fileInput = document.getElementById('docxFile');
        const processBtn = document.getElementById('processBtn');
        const uploadForm = document.getElementById('uploadForm');
        const loading = document.getElementById('loading');
        const resultsSection = document.getElementById('resultsSection');
        const resultsContainer = document.getElementById('resultsContainer');
        const uploadSection = document.getElementById('uploadSection');
        const hashKeyInput = document.getElementById('hashKeyInput');
        const authStatus = document.getElementById('authStatus');

        let isAuthenticated = false;
        let currentHashKey = '';

        // 해시 키 검증
        async function validateHashKey() {
            const hashKey = hashKeyInput.value.trim();
            if (!hashKey) {
                showAuthStatus('Please enter a hash key', 'error');
                return;
            }

            // 고정 해시 키 검증
            const validKey = '60e27a00dc01ca8e39c21cc3989dd525e24371b0bd238fe506e789e8572a69ae';
            
            if (hashKey === validKey) {
                currentHashKey = hashKey;
                isAuthenticated = true;
                showAuthStatus('✅ Hash key validated successfully!', 'success');
                showUploadSection();
            } else {
                showAuthStatus('❌ Invalid hash key', 'error');
            }
        }

        // HMAC 해시 생성 - 제거됨 (더 이상 필요 없음)

        // 인증 상태 표시
        function showAuthStatus(message, type) {
            authStatus.innerHTML = `<div class="auth-status auth-${type}">${message}</div>`;
        }

        // 업로드 섹션 표시
        function showUploadSection() {
            uploadSection.style.display = 'block';
            document.getElementById('hashKey').value = currentHashKey;
        }

        // 드래그 앤 드롭 처리
        uploadArea.addEventListener('dragover', (e) => {
            e.preventDefault();
            uploadArea.classList.add('dragover');
        });

        uploadArea.addEventListener('dragleave', () => {
            uploadArea.classList.remove('dragover');
        });

        uploadArea.addEventListener('drop', (e) => {
            e.preventDefault();
            uploadArea.classList.remove('dragover');
            
            if (!isAuthenticated) {
                alert('Please authenticate with a hash key first!');
                return;
            }
            
            const files = e.dataTransfer.files;
            if (files.length > 0) {
                fileInput.files = files;
                handleFileSelect();
            }
        });

        // 파일 선택 처리
        fileInput.addEventListener('change', handleFileSelect);

        function handleFileSelect() {
            if (!isAuthenticated) {
                alert('Please authenticate with a hash key first!');
                fileInput.value = '';
                return;
            }

            const file = fileInput.files[0];
            if (file) {
                if (file.name.toLowerCase().endsWith('.docx')) {
                    processBtn.disabled = false;
                    processBtn.textContent = `🚀 Process ${file.name}`;
                } else {
                    alert('Please select a DOCX file');
                    fileInput.value = '';
                    processBtn.disabled = true;
                    processBtn.textContent = '🚀 Process DOCX';
                }
            }
        }

        // 폼 제출 처리
        uploadForm.addEventListener('submit', async (e) => {
            e.preventDefault();
            
            if (!isAuthenticated) {
                alert('Please authenticate with a hash key first!');
                return;
            }

            const file = fileInput.files[0];
            if (!file) {
                alert('Please select a file');
                return;
            }

            const formData = new FormData();
            formData.append('docx_file', file);
            formData.append('hash_key', currentHashKey);

            // UI 업데이트
            loading.style.display = 'block';
            resultsSection.style.display = 'none';
            processBtn.disabled = true;

            try {
                const response = await fetch('/upload', {
                    method: 'POST',
                    body: formData
                });

                const result = await response.json();
                displayResults(result, response.status);

            } catch (error) {
                displayResults({
                    error: 'Network error: ' + error.message
                }, 500);
            } finally {
                loading.style.display = 'none';
                processBtn.disabled = false;
            }
        });

        function displayResults(data, status) {
            resultsContainer.innerHTML = '';
            resultsSection.style.display = 'block';

            if (status !== 200) {
                const errorDiv = document.createElement('div');
                errorDiv.className = 'result-item result-error';
                errorDiv.innerHTML = `
                    <h4>❌ Error</h4>
                    <p><strong>Status:</strong> ${status}</p>
                    <p><strong>Message:</strong> ${data.error || 'Unknown error'}</p>
                `;
                resultsContainer.appendChild(errorDiv);
                return;
            }

            // 성공 메시지
            const summaryDiv = document.createElement('div');
            summaryDiv.className = 'result-item result-success';
            summaryDiv.innerHTML = `
                <h4>✅ Processing Complete</h4>
                <p><strong>File ID:</strong> ${data.file_id}</p>
                <p><strong>Relationships Found:</strong> ${data.relationships_found}</p>
                <p><strong>Message:</strong> ${data.message}</p>
                <p><strong>Authenticated:</strong> ${data.authenticated ? '✅ Yes' : '❌ No'}</p>
            `;
            resultsContainer.appendChild(summaryDiv);

            // 각 결과 표시
            if (data.results && data.results.length > 0) {
                data.results.forEach((result, index) => {
                    const resultDiv = document.createElement('div');
                    
                    let className = 'result-item';
                    let statusBadge = '';
                    
                    if (result.flag_found) {
                        className += ' result-flag';
                        statusBadge = '<span class="status-badge badge-warning">🚩 FLAG FOUND!</span>';
                    } else if (result.error) {
                        className += ' result-error';
                        statusBadge = '<span class="status-badge badge-error">ERROR</span>';
                    } else {
                        className += ' result-success';
                        statusBadge = '<span class="status-badge badge-success">SUCCESS</span>';
                    }
                    
                    resultDiv.className = className;
                    
                    let content = `
                        <h4>🔗 Request #${index + 1} ${statusBadge}</h4>
                        <p><strong>URL:</strong> ${result.url}</p>
                        <p><strong>Relationship Type:</strong> ${result.relationship_type}</p>
                        <p><strong>Source File:</strong> ${result.source_file}</p>
                    `;
                    
                    if (result.error) {
                        content += `<p><strong>Error:</strong> ${result.error}</p>`;
                    } else {
                        content += `
                            <p><strong>Status Code:</strong> ${result.status_code}</p>
                            <div class="code-block">
                                <strong>Response Content:</strong><br>
                                ${escapeHtml(result.content)}
                            </div>
                        `;
                        
                        if (result.flag_found) {
                            content += `
                                <div style="margin-top: 15px; padding: 10px; background: #fff3cd; border-radius: 4px;">
                                    <strong>🎉 Congratulations! You found the flag!</strong>
                                </div>
                            `;
                        }
                    }
                    
                    resultDiv.innerHTML = content;
                    resultsContainer.appendChild(resultDiv);
                });
            }
        }

        function escapeHtml(text) {
            const div = document.createElement('div');
            div.textContent = text;
            return div.innerHTML;
        }

        async function loadDebugInfo() {
            try {
                const response = await fetch('/debug');
                const data = await response.json();
                
                const debugInfo = document.getElementById('debugInfo');
                debugInfo.innerHTML = `
                    <div class="code-block">
                        ${JSON.stringify(data, null, 2)}
                    </div>
                `;
            } catch (error) {
                document.getElementById('debugInfo').innerHTML = `
                    <p style="color: red;">Error loading debug info: ${error.message}</p>
                `;
            }
        }

        // Enter 키로 해시 키 검증
        hashKeyInput.addEventListener('keypress', (e) => {
            if (e.key === 'Enter') {
                validateHashKey();
            }
        });
    </script>
</body>
</html>