Fix/stored xss#3362
Open
RachHavoc wants to merge 5 commits into
Open
Conversation
…ismatch - Add data/cookie_storage to DATA_FILE_GLOBS so --fresh removes it - Catch SystemExit in auth_svc when file_svc._read() fails to decrypt stale cookie_storage; regenerate session key instead of crashing - Add tests: DATA_FILE_GLOBS membership + stale cookie recovery Fixes crash when switching between --insecure and secure mode after PR apache#3264 introduced persistent session cookies. Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
|
Azure Pipelines: 1 pipeline(s) were filtered out due to trigger conditions. |
|
Azure Pipelines: 1 pipeline(s) were filtered out due to trigger conditions. |
|
Azure Pipelines: 1 pipeline(s) were filtered out due to trigger conditions. |
|
Contributor
There was a problem hiding this comment.
Pull request overview
This PR hardens the Abilities write-path by validating technique_name server-side in AbilityApiManager._validate_ability_data, addressing a stored XSS vector where HTML/script characters could previously be persisted via the v2 abilities API.
Changes:
- Add a
technique_nameallowlist regex validation in_validate_ability_datato reject HTML/script characters. - Minor whitespace/formatting adjustments in
ability_api_manager.py.
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
| # letters, digits, spaces, hyphens, underscores, parentheses, | ||
| # slashes, dots, commas, colons, and ampersands. | ||
| # Excludes < > " ' ; which are not present in any ATT&CK technique name. | ||
| technique_name_validator = re.compile(r'^[a-zA-Z0-9\s\-_()/.,&:]+$') |
Comment on lines
+83
to
+85
| raise JsonHttpBadRequest(f'Invalid technique_name "{data["technique_name"]}". technique_name can only ' | ||
| 'contain alphanumeric characters, spaces, hyphens, underscores, ' | ||
| 'parentheses, slashes, dots, commas, colons, and ampersands.') |
| def __init__(self, data_svc, file_svc): | ||
| super().__init__(data_svc=data_svc, file_svc=file_svc) | ||
|
|
||
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.


Description
Adds server-side input validation for the
technique_namefield inAbilityApiManager._validate_ability_data.Previously,
technique_namewas accepted as an unconstrained string whileidandtacticwere both validated against an alphanumeric allowlist. This inconsistency allowed HTML/script
characters to be stored via
POST /api/v2/abilitiesandPUT /api/v2/abilities/{id},contributing to a stored XSS vulnerability in the Debrief plugin's technique graph.
A regex allowlist (
^[a-zA-Z0-9\s\-_()/.,&:]+$) is applied totechnique_nameon write,rejecting values containing
< > " ' ;while accepting all legitimate ATT&CK technique names.Related to: fix/technique-name-xss in mitre/debrief.
Type of change
How Has This Been Tested?
POST /api/v2/abilitieswithtechnique_namecontaining HTML (e.g."><img src=x onerror=alert(1)>) now returns HTTP 400.Command and Scripting InterpreterOS Credential Dumping: /etc/passwd and /etc/shadowExploitation for Privilege EscalationMan-in-the-MiddleChecklist: