modules/exploits/linux/local/ntfs3g_priv_esc.rb
Method exploit
has 117 lines of code (exceeds 25 allowed). Consider refactoring. Open
Open
def exploit
def upload_and_compile(filename, file_path, file_content, compile=nil)
rm_f "#{file_path}"
if not compile.nil?
rm_f "#{file_path}.c"
Method check
has a Cognitive Complexity of 18 (exceeds 5 allowed). Consider refactoring. Open
Open
def check
# check if linux headers were installed on Debian (not ubuntu). The 'common' headers won't work.
def headers_installed?()
output = cmd_exec('dpkg -l | grep \'^ii\' | grep linux-headers.*[^common]{7}')
- 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 44 lines of code (exceeds 25 allowed). Consider refactoring. Open
Open
def check
# check if linux headers were installed on Debian (not ubuntu). The 'common' headers won't work.
def headers_installed?()
output = cmd_exec('dpkg -l | grep \'^ii\' | grep linux-headers.*[^common]{7}')
Method initialize
has 39 lines of code (exceeds 25 allowed). Consider refactoring. Open
Open
def initialize(info={})
super( update_info( info, {
'Name' => 'Debian/Ubuntu ntfs-3g Local Privilege Escalation',
'Description' => %q{
ntfs-3g mount helper in Ubuntu 16.04, 16.10, Debian 7, 8, and possibly 9 does not properly sanitize the environment when executing modprobe.