Method initialize
has 45 lines of code (exceeds 25 allowed). Consider refactoring. Open
def initialize(info={})
super(update_info(info,
'Name' => "Trend Micro OfficeScan Remote Code Execution",
'Description' => %q{
This module exploits the authentication bypass and command injection vulnerability together. Unauthenticated users can execute a
Method auth
has 36 lines of code (exceeds 25 allowed). Consider refactoring. Open
def auth(my_target)
# Version XG performs MD5 validation on wf_CSRF_token parameter. We can't simply use PHPSESSID directly because it contains a-zA-Z0-9.
# Beside that, version 11 use PHPSESSID value as a csrf token. Thus, we are manually crafting the cookie.
if my_target.name == 'OfficeScan XG'
csrf_token = build_csrftoken(my_target)
Method exploit
has 30 lines of code (exceeds 25 allowed). Consider refactoring. Open
def exploit
mytarget = auto_target
print_status('Exploiting authentication bypass')
cookie = auth(mytarget)
if cookie.nil?
Method check
has 27 lines of code (exceeds 25 allowed). Consider refactoring. Open
def check
my_target = auto_target
token = auth(my_target)
# If we dont have a cookie that means authentication bypass issue has been patched on target system.
if token.nil?
Method auth
has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring. Open
def auth(my_target)
# Version XG performs MD5 validation on wf_CSRF_token parameter. We can't simply use PHPSESSID directly because it contains a-zA-Z0-9.
# Beside that, version 11 use PHPSESSID value as a csrf token. Thus, we are manually crafting the cookie.
if my_target.name == 'OfficeScan XG'
csrf_token = build_csrftoken(my_target)
- 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 auto_target
has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring. Open
def auto_target
#XG version of the widget library has package.json within the same directory.
mytarget = target
if target['auto'] && target.name =~ /Automatic/
print_status('Automatic targeting enabled. Trying to detect version.')
- 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 6 (exceeds 5 allowed). Consider refactoring. Open
def check
my_target = auto_target
token = auth(my_target)
# If we dont have a cookie that means authentication bypass issue has been patched on target system.
if token.nil?
- 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"