Open bcoles opened 1 week ago
Would adding the parsing logic for all the other network files, the ones you mentioned, be sufficient? I would like to work on it then.
I need help setting up my code space or termux I have yet to completely do it correctly and although I have found quite a bit that's not been talked about i still need help please is there any way some one could give me a completed list of command's for me to do that
On Sat, Nov 2, 2024, 1:10 AM hcrypt @.***> wrote:
Would adding the parsing logic for all the other network files, the ones you mentioned, be sufficient? I would like to work on it then.
— Reply to this email directly, view it on GitHub https://github.com/rapid7/metasploit-framework/issues/19589#issuecomment-2452885897, or unsubscribe https://github.com/notifications/unsubscribe-auth/BLXRFGVCVD3USZJEY6NY6LDZ6RUDZAVCNFSM6AAAAABQUVF4PKVHI2DSMVQWIX3LMV43OSLTON2WKQ3PNVWWK3TUHMZDINJSHA4DKOBZG4 . You are receiving this because you are subscribed to this thread.Message ID: @.***>
The post/linux/gather/enum_psk module file name and module name do not match and are misleading.
This module has a generic name (
enum_psk
). A more appropriate name would beenum_wifi_psk
; although it is generally expected that PSK relates to WiFi pre-shared keys.This module retrieves WiFi PSKs stored by NetworkManager only:
https://github.com/rapid7/metasploit-framework/blob/1a6cf9dfa77868e97953594b925ad1dedd376ad3/modules/post/linux/gather/enum_psk.rb#L16
https://github.com/rapid7/metasploit-framework/blob/1a6cf9dfa77868e97953594b925ad1dedd376ad3/modules/post/linux/gather/enum_psk.rb#L35
This module has seen no major updates since it was added in 2014.
There are other WiFi management software for Linux which may store WiFi passwords in different formats in different places on the file system.
Unfortunately, as the default hard-coded path for the
DIR
option is specific to NetworkManager, updates to this module to support other software may break backwards compatibility for existing workflows.Note also that the existing PSK parsing logic contains a flaw which will truncate all characters after the first
=
character in a PSK:https://github.com/rapid7/metasploit-framework/blob/1a6cf9dfa77868e97953594b925ad1dedd376ad3/modules/post/linux/gather/enum_psk.rb#L54
Steps to reproduce
use post/linux/gather/enum_psk
set session <session>
run
Example Configuration Files
Copilot also offers the following common WiFi configuration file locations:
Here is an example netplan configuration file from an Armbian Linux system:
Note that the PSK is stored in YAML format. The existing file parsing logic performs a lowercase match for lines beginning with
psk=
and would not identify the PSK if the user specified the correctDIR
.https://github.com/rapid7/metasploit-framework/blob/1a6cf9dfa77868e97953594b925ad1dedd376ad3/modules/post/linux/gather/enum_psk.rb#L52
Copilot offers the following example
/etc/sysconfig/network-scripts/ifcfg-wlan0
file:Note that the PSK is stored on a line beginning with
PSK=
. The existing file parsing logic performs a lowercase match for lines beginning withpsk=
and would not identify the PSK if the user specified the correctDIR
.https://github.com/rapid7/metasploit-framework/blob/1a6cf9dfa77868e97953594b925ad1dedd376ad3/modules/post/linux/gather/enum_psk.rb#L52
Copilot offers the following example
/etc/wpa_supplicant/wpa_supplicant.conf
file:Note that the PSK is stored on a line beginning with whitespace followed by
psk=
. The existing file parsing logic performs a lowercase match for lines beginning withpsk=
and would not identify the PSK if the user specified the correctDIR
.https://github.com/rapid7/metasploit-framework/blob/1a6cf9dfa77868e97953594b925ad1dedd376ad3/modules/post/linux/gather/enum_psk.rb#L52
Copilot offers the following example
/etc/netctl
file:Note that the PSK is stored on a line beginning with
Key=
. The existing file parsing logic performs a lowercase match for lines beginning withpsk=
and would not identify the PSK if the user specified the correctDIR
.https://github.com/rapid7/metasploit-framework/blob/1a6cf9dfa77868e97953594b925ad1dedd376ad3/modules/post/linux/gather/enum_psk.rb#L52