Skip to content

feat: add multipart/form-data XXE detection support#7432

Open
cedricbu wants to merge 2 commits into
zaproxy:mainfrom
cedricbu:ascan-multipart-form-data-XXE-detection-support
Open

feat: add multipart/form-data XXE detection support#7432
cedricbu wants to merge 2 commits into
zaproxy:mainfrom
cedricbu:ascan-multipart-form-data-XXE-detection-support

Conversation

@cedricbu

@cedricbu cedricbu commented Jun 8, 2026

Copy link
Copy Markdown

Port logic from PR #2864 to detect XXE vulnerabilities when XML content is uploaded as part of a multipart/form-data request. Uses VariantMultipartFormParameters to parse and inject payloads into multipart bodies while preserving other form parts.

Includes import reorder and state reset fix for scanner reuse.

Overview

The original PR #2864 was apparently in a working state, but abandoned (and no longer relevant since aimed at ascan-beta, while XXE was moved to ascan). This PR steals the idea, adapting the code for the latest ascan code.
I tested it against juice-shop, and it worked:
step 1: upload a random XML file in the "complaints" form
step 2: attack the file-upload() POST endpoint, and make sure that XXE policy is enabled

Related Issues

zaproxy/zaproxy#8817
zaproxy/zaproxy#1190

Port logic from PR zaproxy#2864 to detect XXE vulnerabilities when XML
content is uploaded as part of a multipart/form-data request.
Uses VariantMultipartFormParameters to parse and inject payloads
into multipart bodies while preserving other form parts.

Includes import reorder and state reset fix for scanner reuse.

Signed-off-by: Cedric Buissart <cbuissar@redhat.com>
@github-actions

github-actions Bot commented Jun 8, 2026

Copy link
Copy Markdown

All contributors have signed the CLA ✍️ ✅
Posted by the CLA Assistant Lite bot.

@psiinon

psiinon commented Jun 8, 2026

Copy link
Copy Markdown
Member

Logo
Checkmarx One – Scan Summary & Details5b33a36d-553f-4426-9958-7cf9931048af

Great job! No new security vulnerabilities introduced in this pull request


Use @Checkmarx to interact with Checkmarx PR Assistant.
Examples:
@Checkmarx how are you able to help me?
@Checkmarx rescan this PR

@thc202

thc202 commented Jun 8, 2026

Copy link
Copy Markdown
Member

but abandoned (and no longer relevant since aimed at ascan-beta, while XXE was moved to ascan).

Neither is true.

@cedricbu

cedricbu commented Jun 8, 2026

Copy link
Copy Markdown
Author

I have read the CLA Document and I hereby sign the CLA

@kingthorin

Copy link
Copy Markdown
Member

I believe this should override scan(NameValuePair), checking the type of the name value pair, so that users' input variant selection is respected.

Rework multipart handling to use AbstractAppParamPlugin's variant
framework instead of manually creating VariantMultipartFormParameters.
This ensures the user's input vector selection is respected.

- Change XxeScanRule to extend AbstractAppParamPlugin
- Override scan(List<NameValuePair>) to identify XML file parts by
  their declared content-type
- Override scan(HttpMessage, NameValuePair) to run XXE attacks on
  matching multipart file parameters
- Replace multipartVariant.setParameter() with the inherited
  setParameter() from AbstractAppParamPlugin
- Restore Javadoc comments on scan(), localFileReflectionAttack(),
  and localFileInclusionAttack()

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
@cedricbu

Copy link
Copy Markdown
Author

but abandoned (and no longer relevant since aimed at ascan-beta, while XXE was moved to ascan).

Neither is true.

Thanks for the clarification

@cedricbu

Copy link
Copy Markdown
Author

I believe this should override scan(NameValuePair), checking the type of the name value pair, so that users' input variant selection is respected.

Thanks! I adapted the code based on your suggestion. I hope I got it right this time

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Development

Successfully merging this pull request may close these issues.

4 participants