Blog

セキュア・コーディング技法:XML データの処理、第 1 部

December 10, 2017
ピーター・ド・クレマー

拡張マークアップ言語 (XML) は、機械にとって扱いやすく、人間が読める形式で文書をエンコードするために使用されるマークアップ言語です。しかし、この一般的に使用されている形式には、複数のセキュリティ上の欠陥があります。今回初めての XML 関連のブログ記事では、スキーマを使用して XML 文書を安全に処理するための基本について説明します。

OWASPは、XMLとXMLスキーマに関連するさまざまな脆弱性を2つのカテゴリに分類しています。

形式が正しくありません XML 文書

形式が正しくない XML 文書とは、W3C XML 仕様に従わない文書です。不正な形式の文書になる例としては、終了タグの削除、さまざまな要素の順序の変更、禁止文字の使用などがあります。これらのエラーはすべて致命的なエラーになるはずであり、文書に追加の処理を行うべきではありません。

不正な形式の文書による脆弱性を回避するには、W3C 仕様に準拠し、形式が正しくない文書の処理にそれほど時間がかからない、十分にテストされた XML パーサーを使用する必要があります。

XML ドキュメントが無効です

無効な XML ドキュメントは正しい形式ですが、予期しない値が含まれています。攻撃者は、XML スキーマを適切に定義していないアプリケーションを悪用して、文書が有効かどうかを確認する可能性があります。正しく検証されないと意図しない結果になる可能性がある文書の簡単な例を以下に示します。

トランザクションを XML データに保存するウェブストア:

<purchase></purchase>
<id>123</id>
<price>200</price>

また、<id>ユーザーは値を制御することしかできません。そうすれば、適切な対策を講じなければ、攻撃者は次のような情報を入力する可能性があります</id>。

<purchase></purchase>
<id>123</id>
<price>0</price>
<id></id>
<price>200</price>

このドキュメントを処理するパーサーが、<id><price>とタグの最初のインスタンスのみを読み取ると、望ましくない結果になります</price></id>。

また、スキーマの制限が十分でなかったり、他の入力検証が不十分だったりして、負の数値、特殊な10進数 (NaNやInfinityなど)、または非常に大きな値が予期しない場所に入力され、同様の意図しない動作が発生する可能性もあります。

不正なデータ検証の問題を回避するには、正確で制限の厳しいXMLスキーマを定義して、無効な XML 文書に関連する脆弱性を回避する必要があります。

次回のブログ記事では、ジャンボ・ペイロードや、恐れられているOWASPのトップ10第4位であるXXEなど、XML文書に対するより高度な攻撃について説明します。

それまでの間、XML 入力検証のスキルを磨いたり、挑戦したりすることができます。 私たちのポータルで。

XML および XML スキーマの仕様には、複数のセキュリティ上の欠陥があります。同時に、これらの仕様には XML アプリケーションの保護に必要なツールも含まれています。XML スキーマを使用して XML 文書のセキュリティを定義していますが、ファイル検索、サーバー側のリクエスト偽造、ポートスキャン、ブルートフォースなど、さまざまな攻撃に利用される可能性があります。

https://www.owasp.org/index.php/XML_Security_Cheat_Sheet

キャッチフレーズ

Govern AI-driven development before it ships

Measure AI-assisted risk, enforce secure coding policy at commit, and accelerate secure delivery across your SDLC.

book a demo
キャッチフレーズ

Explore more blogs

これは、オーラが射手と鼻の穴を広げることによって、腸管を熱的に発芽させ、臭いを帯びていることを防ぐためのものです。

browse all
Case Study
Filter Label
This is some text inside of a div block.

Supercharged Security Awareness: How Tournaments are Inspiring Developers at Erste Group

Lorem ipsum dolor sit amet, consectetur adipiscing elit. Suspendisse varius enim in eros elementum tristique. Duis cursus, mi quis viverra ornare, eros dolor interdum nulla, ut commodo diam libero vitae erat. Aenean faucibus nibh et justo cursus id rutrum lorem imperdiet. Nunc ut sem vitae risus tristique posuere.

Learn More
Case Study
Filter Label
This is some text inside of a div block.

Security as culture: How Blue Prism cultivates world-class secure developers

Learn how Blue Prism, the global leader in intelligent automation for the enterprise, used Secure Code Warrior's agile learning platform to create a security-first culture with their developers, achieve their business goals, and ship secure code at speed

Learn More
Case Study
Filter Label
This is some text inside of a div block.

One Culture of Security: How Sage built their security champions program with agile secure code learning

Discover how Sage enhanced security with a flexible, relationship-focused approach, creating 200+ security champions and achieving measurable risk reduction.

Learn More
Blog
Filter Label
This is some text inside of a div block.

Are you a CISO or Engineering Leader worried about the Security and Cost of LLM code generation?

Review the SCW AI Trust Index, our proprietary LLM benchmarking data, before going all-in on an AI model.

Learn More
Blog
Filter Label
This is some text inside of a div block.

Enabler 6: Regular Reporting to Leadership

Executive buy-in doesn't sustain itself. Enabler 6 shows how regular reporting keeps leadership engaged, informed, and invested in program success.

Learn More
Blog
Filter Label
This is some text inside of a div block.

The Future of AI Software Governance Is Built on Strong Partnerships

Discover why Secure Code Warrior is becoming a channel-first company and how trusted partners help organizations adopt AI Software Governance securely and at scale.

Learn More

Secure AI-driven development before it ships

See developer risk, enforce policy, and prevent vulnerabilities across your software development lifecycle.

Book a demo