Metasploit-framework: Metepreter Powershell Extension Doesn't load the smbserver module by default

Created on 6 Nov 2017  路  1Comment  路  Source: rapid7/metasploit-framework

Steps to reproduce

How'd you do it?

  1. Get a meterpreter session
  2. Load in powershell
  3. run powershell_shell
  4. PS> Get-SmbServerConfiguration

Expected behavior

Microsoft Windows [Version 6.3.9600]
(c) 2013 Microsoft Corporation. All rights reserved.

C:\UsersAdministrator>powershell
Windows PowerShell
Copyright (C) 2013 Microsoft Corporation. All rights reserved.

PS C:\UsersAdministrator> Get-SmbServerConfiguration

AnnounceServer : False
AsynchronousCredits : 64
AutoShareServer : True
AutoShareWorkstation : True
CachedOpenLimit : 5
AnnounceComment :
EnableDownlevelTimewarp : False
EnableLeasing : True
EnableMultiChannel : True
EnableStrictNameChecking : True
AutoDisconnectTimeout : 0
DurableHandleV2TimeoutInSeconds : 30
EnableAuthenticateUserSharing : False
EnableForcedLogoff : True
EnableOplocks : True
EnableSecuritySignature : False
ServerHidden : True
IrpStackSize : 15
KeepAliveTime : 2
MaxChannelPerSession : 32
MaxMpxCount : 50
MaxSessionPerConnection : 16384
MaxThreadsPerQueue : 20
MaxWorkItems : 1
NullSessionPipes :
NullSessionShares :
OplockBreakWait : 35
PendingClientTimeoutInSeconds : 120
RequireSecuritySignature : False
EnableSMB1Protocol : True
EnableSMB2Protocol : True
Smb2CreditsMax : 2048
Smb2CreditsMin : 128
SmbServerNameHardeningLevel : 0
TreatHostAsStableStorage : False
ValidateAliasNotCircular : True
ValidateShareScope : True
ValidateShareScopeNotAliased : True
ValidateTargetName : True
EncryptData : False
RejectUnencryptedAccess : True

PS C:\UsersAdministrator>
What should happen?

Current behavior

meterpreter > powershell_shell
PS > Get-SmbServerConfiguration
ERROR: Get-SmbServerConfiguration : The term 'Get-SmbServerConfiguration' is not recognized as the name of a cmdlet, function,
ERROR: script file, or operable program. Check the spelling of the name, or if a path was included, verify that the path is c
ERROR: orrect and try again.
ERROR:
ERROR: At line:1 char:27
ERROR: + Get-SmbServerConfiguration <<<<
ERROR: + CategoryInfo : ObjectNotFound: (Get-SmbServerConfiguration:String) [], CommandNotFoundException
ERROR: + FullyQualifiedErrorId : CommandNotFoundException
ERROR:
PS >
What happens instead?

You might also want to check the last ~1k lines of
/opt/metasploit/apps/pro/engine/config/logs/framework.log or
~/.msf4/logs/framework.log for relevant stack traces

System stuff

Kali Linux 2017.2

Metasploit version

Framework: 4.16.14-dev
Console : 4.16.14-dev
Get this with the version command in msfconsole (or git log -1 --pretty=oneline for a source install).

I installed Metasploit with:

  • [*] Kali package via apt

OS

What OS are you running Metasploit on?
Kali Linux 2017.2

Most helpful comment

The Powershell extension doesn't really load anything by default. It's a bare PS environment that needs to be populated.

I think a bigger question to tackle here is: what is deemed to be a minimal requirement for this extension as far as built-in libs and whatnot is concerned? Let's not forget we're aiming to function on a lot of different machines that will have different versions. Are we guaranteed to have support for the scripts we want loaded? Will loading them make too much unnecessary noise? Perhaps it'd make more sense to have another command that attempts to load built-in scripts?

I'm not a fan of the idea of loading these by default.

>All comments

The Powershell extension doesn't really load anything by default. It's a bare PS environment that needs to be populated.

I think a bigger question to tackle here is: what is deemed to be a minimal requirement for this extension as far as built-in libs and whatnot is concerned? Let's not forget we're aiming to function on a lot of different machines that will have different versions. Are we guaranteed to have support for the scripts we want loaded? Will loading them make too much unnecessary noise? Perhaps it'd make more sense to have another command that attempts to load built-in scripts?

I'm not a fan of the idea of loading these by default.

Was this page helpful?
0 / 5 - 0 ratings

Related issues

adrianmihalko picture adrianmihalko  路  3Comments

notdodo picture notdodo  路  3Comments

fluit105 picture fluit105  路  3Comments

bugshere picture bugshere  路  3Comments

Funeoz picture Funeoz  路  3Comments