Skip to content

Replace kernel_arch with get_os_architecture#21429

Open
zeroSteiner wants to merge 2 commits intorapid7:masterfrom
zeroSteiner:fix/redundant-kernel-version
Open

Replace kernel_arch with get_os_architecture#21429
zeroSteiner wants to merge 2 commits intorapid7:masterfrom
zeroSteiner:fix/redundant-kernel-version

Conversation

@zeroSteiner
Copy link
Copy Markdown
Contributor

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.

Copy link
Copy Markdown
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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::Architecture in Msf::Post::Linux::Kernel.
  • Replace the kernel_arch implementation with an alias to get_os_architecture.

Impact Analysis:

  • Blast radius: medium—affects all code calling kernel_arch via Msf::Post::Linux::Kernel, plus existing unit tests for this mixin; downstream consumer behavior depends on whether callers assume kernel_arch works without an attached session (Unknown beyond identified spec usage).
  • Data and contract effects: kernel_arch now inherits get_os_architecture’s contract (uses session/sysinfo; may return nil per 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.rb and validate common Linux modules that call kernel_arch still behave correctly across meterpreter + shell sessions.

Comment thread lib/msf/core/post/linux/kernel.rb
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

Status: Todo

Development

Successfully merging this pull request may close these issues.

3 participants