Replace kernel_arch with get_os_architecture#21429
Open
zeroSteiner wants to merge 2 commits intorapid7:masterfrom
Open
Replace kernel_arch with get_os_architecture#21429zeroSteiner wants to merge 2 commits intorapid7:masterfrom
zeroSteiner wants to merge 2 commits intorapid7:masterfrom
Conversation
Contributor
There was a problem hiding this comment.
Pull request overview
This PR removes the Linux-specific kernel_arch implementation and routes Linux kernel architecture detection through the platform-agnostic get_os_architecture, aiming for a single architecture source of truth that also supports meterpreter sessions without relying on uname.
Changes:
- Include
Msf::Post::ArchitectureinMsf::Post::Linux::Kernel. - Replace the
kernel_archimplementation with an alias toget_os_architecture.
Impact Analysis:
- Blast radius: medium—affects all code calling
kernel_archviaMsf::Post::Linux::Kernel, plus existing unit tests for this mixin; downstream consumer behavior depends on whether callers assumekernel_archworks without an attachedsession(Unknown beyond identified spec usage). - Data and contract effects:
kernel_archnow inheritsget_os_architecture’s contract (usessession/sysinfo; may returnnilper its documentation), which differs from the prior always-string behavior. - Rollback and test focus: run the existing
spec/lib/msf/core/post/linux/kernel_spec.rband validate common Linux modules that callkernel_archstill behave correctly across meterpreter + shell sessions.
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.
Now that #21418 has been merged, Metasploit has a platform agnostic way to obtain the OS/Kernel architecture. This technique has the added benefit of supporting meterpreter sessions directly (meaning we don't always run
uname).This PR removes the now redundant Linux-specific method so there's a single source of truth that works in a superset of platform / session-type combinations.