Skip to content

Commit

Permalink
Fix bad regex on length of "Metasploit" string
Browse files Browse the repository at this point in the history
It won't match a char because it's a newline. While sticking "m" on the
end of the regex would work, there is zero reason we can't hardcode the
length, since the string is fixed.

irb(main):001:0> /.hi/ =~ "\nhi"
=> nil
irb(main):002:0> /.hi/m =~ "\nhi"
=> 0
irb(main):003:0>
  • Loading branch information
wvu committed Apr 10, 2020
1 parent 4a7dd38 commit c7cc9ca
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion modules/exploits/multi/http/jenkins_metaprogramming.rb
Original file line number Diff line number Diff line change
Expand Up @@ -308,7 +308,7 @@ def constructor_class
)

# Replace length-prefixed string "Metasploit" with a random one
klass.sub(/.Metasploit/, "#{[app.length].pack('C')}#{app}")
klass.sub("\x0aMetasploit", "#{[app.length].pack('C')}#{app}")
end

#
Expand Down

0 comments on commit c7cc9ca

Please sign in to comment.