Add kernel_rex_version for kernel parsing#21008
Open
EclipseAditya wants to merge 1 commit intorapid7:masterfrom
Open
Add kernel_rex_version for kernel parsing#21008EclipseAditya wants to merge 1 commit intorapid7:masterfrom
EclipseAditya wants to merge 1 commit intorapid7:masterfrom
Conversation
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Adds
kernel_rex_versiontoMsf::Post::Linux::Kernelthat extracts the upstream kernel version fromuname -rand returns aRex::Version. This replaces thesplit('-').firstpattern duplicated across 15 modules that crashed withArgumentErroron distro-specific suffixes (Amazon Linux, Fedora, RHEL, SUSE, etc.).CheckCode::Unknowninstead ofCheckCode::Safewhen version can't be parsedrescue ArgumentErrorband-aids added in guard Rex::Version.new against crashes on local modules #19813vmwgfx_fd_priv_escboundary (>to>=) that excluded kernel 4.14.0cve_2021_3490Fedora dead code (>=to>for 5.11.20)Fixes #19855
Verification
bundle exec rspec spec/lib/msf/core/post/linux/kernel_spec.rbbundle exec ruby msftidy.rb vmwgfx_fd_priv_esc.rb docker_cgroup_escape.rb modules/exploits/example_linux_priv_esc.rbgrep -rn "Rex::Version.new.*kernel_release" modules/exploits/irbRex::Version.new("4.14.355-275.572.amzn2.x86_64")ArgumentError(the original bug)Rex::Version.new("4.14.355-275.572.amzn2.x86_64".split('-').first)Rex::Version "4.14.355"(whatkernel_rex_versiondoes)use exploit/linux/local/vmwgfx_fd_priv_esc