Class: Contrast::Agent::Protect::Rule::Xxe
- Defined in:
- lib/contrast/agent/protect/rule/xxe.rb,
lib/contrast/agent/protect/rule/xxe/entity_wrapper.rb
Overview
Implementation of the XXE Protect Rule used to evaluate XML calls for exploit of unsafe external entity resolution.
Defined Under Namespace
Classes: EntityWrapper
Constant Summary collapse
- NAME =
'xxe'
- BLOCK_MESSAGE =
'XXE rule triggered. Response blocked.'
- EXTERNAL_ENTITY_PATTERN =
/<!ENTITY\s+[a-zA-Z0-f]+\s+(?:SYSTEM|PUBLIC)\s+(.*?)>/.cs__freeze
Constants inherited from Base
Base::BLOCKING_MODES, Base::OFF, Base::POSTFILTER_MODES, Base::STACK_COLLECTION_RESULTS, Base::UNKNOWN_USER_INPUT
Instance Attribute Summary
Attributes inherited from Base
Instance Method Summary collapse
-
#infilter(context, framework, xml) ⇒ Object
Given an xml, evaluate it for an XXE attack.
- #name ⇒ Object
Methods inherited from Base
#append_to_activity, #build_attack_with_match, #build_attack_without_match, #enabled?, #excluded?, #infilter?, #initialize, #postfilter, #prefilter, #stream_safe?
Methods included from Components::Interface
Constructor Details
This class inherits a constructor from Contrast::Agent::Protect::Rule::Base
Instance Method Details
#infilter(context, framework, xml) ⇒ Object
Given an xml, evaluate it for an XXE attack.
30 31 32 33 34 35 36 37 38 |
# File 'lib/contrast/agent/protect/rule/xxe.rb', line 30 def infilter context, framework, xml result = find_attacker(context, xml, framework: framework) return nil unless result append_to_activity(context, result) return unless blocked? raise Contrast::SecurityException.new(self, BLOCK_MESSAGE) end |