-
-
Notifications
You must be signed in to change notification settings - Fork 138
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
libxml2 >= 2.9.2 fails to escape comments within some attributes. It wants to ensure these comments can be treated as "server-side includes", but as a result fails to ensure that serialization is well-formed, resulting in an opportunity for XSS injection of code into a final re-parsed document (presumably in a browser). See #144 for more details and history around this libxml2 issue, which goes back a few years. At this point it's not clear to your humble maintainer why this hasn't been addressed upstream by libxml2 maintainers, and so I'm working around it in Loofah to protect Loofah users, while simultaneously attempting to escalate the issue upstream. [fixes #144]
- Loading branch information
1 parent
d64b74d
commit 4a08c25
Showing
4 changed files
with
124 additions
and
3 deletions.
There are no files selected for viewing
This file contains 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
This file contains 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,26 @@ | ||
# coding: utf-8 | ||
require 'set' | ||
|
||
module Loofah | ||
# | ||
# constants related to working around unhelpful libxml2 behavior | ||
# | ||
# ಠ_ಠ | ||
# | ||
module LibxmlWorkarounds | ||
# | ||
# these attributes and qualifying parent tags are determined by the code at: | ||
# | ||
# https://git.gnome.org/browse/libxml2/tree/HTMLtree.c?h=v2.9.2#n714 | ||
# | ||
# see comments about CVE-2018-8048 within the tests for more information | ||
# | ||
BROKEN_ESCAPING_ATTRIBUTES = Set.new %w[ | ||
href | ||
action | ||
src | ||
name | ||
] | ||
BROKEN_ESCAPING_ATTRIBUTES_QUALIFYING_TAG = {"name" => "a"} | ||
end | ||
end |
This file contains 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
This file contains 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