googleads / googleads/googleads-python-lib
[Bug] Potential Billion Laughs Attack Vector via Unrestricted XML Parsing in `ZeepSchemaHelper`
まだ誰も着手していません。
- 主要言語
- Python
- スター
- 749
- フォーク
- 967
- PR マージ指標
- 30日以内にマージされた PR はありません
説明
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
コントリビューションガイド
はじめの一歩
- issue を最後まで読み、次にプロジェクトのコントリビューションガイドを読みます。
- 着手することを issue にコメントします — 二人が同じ作業をするのを防げます。
- リポジトリをフォークし、ブランチを切って変更します。
- issue 番号を参照したプルリクエストを送ります。
調査の方向性
googleads/common.py の ZeepSchemaHelper から始め、特に transport.load(endpoint) と lxml.etree.fromstring(data) の呼び出しを確認してください。XML パーサーがどのように設定されているかを見直し、報告されているエンティティ展開と外部ネットワークアクセスのリスクに対するテストカバレッジを追加してください。完了条件は、スキーマが引き続き読み込まれる一方で、信頼できない XML によってエンティティ展開やネットワークアクセスが発生しないことです。
索引モデルが issue の本文から書いたものです。
評価
- 技術スタック
- python
- 領域
- security
- issue の種類
- バグ
- 難易度
- 3/5
- 見積もり時間
- 1〜2日
- 活発さ
- 停滞
- 明瞭さ
- 明確に書かれている
- 初心者へのやさしさ
- 45/100