rapid7/metasploit-framework

View on GitHub
modules/auxiliary/gather/magento_xxe_cve_2024_34102.rb

Summary

Maintainability
B
4 hrs
Test Coverage

Method initialize has 31 lines of code (exceeds 25 allowed). Consider refactoring.
Open

  def initialize(info = {})
    super(
      update_info(
        info,
        'Name' => 'Magento XXE Unserialize Arbitrary File Read',
Severity: Minor
Found in modules/auxiliary/gather/magento_xxe_cve_2024_34102.rb - About 1 hr to fix

    Method xxe_request has 28 lines of code (exceeds 25 allowed). Consider refactoring.
    Open

      def xxe_request
        vprint_status('Sending XXE request')
    
        signature = Rex::Text.rand_text_alpha(6).capitalize
    
    
    Severity: Minor
    Found in modules/auxiliary/gather/magento_xxe_cve_2024_34102.rb - About 1 hr to fix

      Consider simplifying this complex logical expression.
      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')) ||
      Severity: Major
      Found in modules/auxiliary/gather/magento_xxe_cve_2024_34102.rb - About 1 hr to fix

        Method on_request_uri has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring.
        Open

          def on_request_uri(cli, req)
            super
            data = ''
        
            case req.uri
        Severity: Minor
        Found in modules/auxiliary/gather/magento_xxe_cve_2024_34102.rb - About 45 mins to fix

        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

          def check
            vprint_status('Trying to get the Magento version')
        
            # request to check if the target is vulnerable /magento_version
            res = send_request_cgi({
        Severity: Minor
        Found in modules/auxiliary/gather/magento_xxe_cve_2024_34102.rb - About 35 mins to fix

        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

        There are no issues that match your filters.

        Category
        Status