modules/auxiliary/gather/magento_xxe_cve_2024_34102.rb
Method initialize
has 31 lines of code (exceeds 25 allowed). Consider refactoring. Open
Open
def initialize(info = {})
super(
update_info(
info,
'Name' => 'Magento XXE Unserialize Arbitrary File Read',
Method xxe_request
has 28 lines of code (exceeds 25 allowed). Consider refactoring. Open
Open
def xxe_request
vprint_status('Sending XXE request')
signature = Rex::Text.rand_text_alpha(6).capitalize
Consider simplifying this complex logical expression. Open
Open
return CheckCode::Safe("Detected Magento #{edition} edition version #{version} which is not vulnerable") unless
version <= (Rex::Version.new('2.4.7')) ||
version <= (Rex::Version.new('2.4.6-p5')) ||
version <= (Rex::Version.new('2.4.5-p7')) ||
version <= (Rex::Version.new('2.4.4-p8')) ||
Method on_request_uri
has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring. Open
Open
def on_request_uri(cli, req)
super
data = ''
case req.uri
- Read upRead up
Cognitive Complexity
Cognitive Complexity is a measure of how difficult a unit of code is to intuitively understand. Unlike Cyclomatic Complexity, which determines how difficult your code will be to test, Cognitive Complexity tells you how difficult your code will be to read and comprehend.
A method's cognitive complexity is based on a few simple rules:
- Code is not considered more complex when it uses shorthand that the language provides for collapsing multiple statements into one
- Code is considered more complex for each "break in the linear flow of the code"
- Code is considered more complex when "flow breaking structures are nested"
Further reading
Method check
has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring. Open
Open
def check
vprint_status('Trying to get the Magento version')
# request to check if the target is vulnerable /magento_version
res = send_request_cgi({
- Read upRead up
Cognitive Complexity
Cognitive Complexity is a measure of how difficult a unit of code is to intuitively understand. Unlike Cyclomatic Complexity, which determines how difficult your code will be to test, Cognitive Complexity tells you how difficult your code will be to read and comprehend.
A method's cognitive complexity is based on a few simple rules:
- Code is not considered more complex when it uses shorthand that the language provides for collapsing multiple statements into one
- Code is considered more complex for each "break in the linear flow of the code"
- Code is considered more complex when "flow breaking structures are nested"