[Bug] Potential Billion Laughs Attack Vector via Unrestricted XML Parsing in `ZeepSchemaHelper`
まだ誰も着手していません。
評価
調査の方向性
googleads/common.py の ZeepSchemaHelper から始め、特に transport.load(endpoint) と lxml.etree.fromstring(data) の呼び出しを確認してください。XML パーサーがどのように設定されているかを見直し、報告されているエンティティ展開と外部ネットワークアクセスのリスクに対するテストカバレッジを追加してください。完了条件は、スキーマが引き続き読み込まれる一方で、信頼できない XML によってエンティティ展開やネットワークアクセスが発生しないことです。
索引モデルが issue の本文から書いたものです。
説明
Hello Google Ads API Team,
Firstly, thanks so much for your great work!
While using and reviewing the googleads-python-lib, I came across a potential XML parsing issue in the ZeepSchemaHelper class that I'd like to raise for discussion.
I understand that the library is designed to work with trusted WSDL endpoints provided by Google, and this issue is unlikely to be exploitable under normal use. However, for defense-in-depth and potential future-proofing, I wanted to share the finding.
# Affected Source Code: `googleads/common.py`
class ZeepSchemaHelper(GoogleSchemaHelper):
def __init__(self, endpoint, timeout, proxy_config, namespace_override, cache):
...
transport = _ZeepProxyTransport(timeout, proxy_config, cache)
try:
data = transport.load(endpoint) # [Untrusted Input Source: XML from user-supplied endpoint]
except requests.exceptions.HTTPError as e:
raise googleads.errors.GoogleAdsSoapTransportError(str(e))
self.schema = zeep.xsd.Schema(
lxml.etree.fromstring(data) # [VULNERABILITY SINK: unsafe XML parsing]
)
This type of attack leverages recursive entity declarations in XML to cause exponential memory usage like the Billion Laughs attack.
We can set
parser = lxml.etree.XMLParser(
resolve_entities=False,
load_dtd=False,
no_network=True
)
to solve this
- 主要言語
- Python
- スター
- 749
- フォーク
- 967
- PR マージ指標
- 30日以内にマージされた PR はありません
コントリビューションガイド
はじめの一歩
- issue を最後まで読み、次にプロジェクトのコントリビューションガイドを読みます。
- 着手することを issue にコメントします — 二人が同じ作業をするのを防げます。
- リポジトリをフォークし、ブランチを切って変更します。
- issue 番号を参照したプルリクエストを送ります。
googleads/googleads-python-lib のほかの issue
-
難易度 3/5 1〜2日 初心者へのやさしさ 35/100
-
難易度 4/5 3〜5日 初心者へのやさしさ 25/100
-
image-package オープン
難易度 5/5 1週間以上 初心者へのやさしさ 10/100
-
難易度 1/5 1時間未満 初心者へのやさしさ 1/100
-
難易度 4/5 3〜5日 初心者へのやさしさ 35/100
googleads/googleads-python-lib の issue をすべて見る
似ている issue
-
難易度 2/5 1〜3時間 初心者へのやさしさ 65/100
qgis/QGIS-Documentation#11275 ·
-
bug priority:normal ready-for-dev
難易度 2/5 1〜3時間 初心者へのやさしさ 88/100
OpenHands/extensions#626 · コメント 1 件 ·
-
難易度 1/5 1時間未満 初心者へのやさしさ 90/100
CSCfi/sd-search-api#39 ·
-
難易度 1/5 1時間未満 初心者へのやさしさ 90/100
-
難易度 2/5 1〜3時間 初心者へのやさしさ 68/100
StevenBlack/hosts#3255 ·