Let's briefly talk about maintaining access.
So when it comes to maintaining access that means that as an attacker if something were to happen to
the machine that we are on we have a way to gain access back to that machine.
Now say for example we're in the middle of working on a shell and the user decides to shut down the
computer and go home for the day.
Well guess what.
We're gonna lose that shell and we could have it to where you know maybe if they go home and they turn
it on for work then we'd have access back to it regardless of where they're at.
And we could attempt to maintain access you know be a command and control and there's a lot of these
advanced techniques now typically as a penetration tester you're not going to be doing this the most
maintaining access that you're going to do is gonna be right down here.
Perhaps you get on a machine and you're in an environment where the you know it's a pen task not a red
team assessment a pen test.
The environment's not great.
You know we're we're just up against it they're not catching most of stuff you're doing you can pretty
easily add a user to a local machine.
And then guess what you can use P.S. exact or do whatever you want to go back to that machine and have
a shell on it pretty easily.
So this is what I like to do for persistence.
I just like to add a user.
I don't like to go and do crazy things.
So all these persistent scripts like here's a persistent script here the run persistence says H this
is all my display when I'm showing you here.
Now this this is dangerous because what you're doing here is you are opening a port on a machine in
that port has zero authentication mechanism.
It's literally just an open port when you connect to it you get a shell in the machine.
Super dangerous to run this and you really have to have a reason to do it.
I have never felt that I had a reason to do it on a pen desk.
Now that's just me.
Other people might disagree but in my opinion I just don't I don't have a reason.
The other thought is that you can run a scheduled task.
So basically what happens is you have malware on the computer.
And this task will check in every so often say every five minutes.
So that way if the computer gets rebooted the task runs again.
And while it's you know while it runs you get the shell back to your machine.
And guess what you have access again.
We typically don't worry about this.
All right.
So this is just concepts I wanted to show you and talk about because they are part of the five stages
of hacking.
In my opinion this falls way more in line with red teaming which is a lot more advanced than pen testing
and a lot more of a quiet skill set where pen testing is kind of being loud and adding a user is definitely
being loud.
But most the time you're going to go up against clients where being loud is perfectly fine.
I would say 75 percent of the time or greater your client's not gonna catch this.
So keep that in mind just understand what maintaining access is.
It's not really in scope for what we're doing or what we're trying to achieve.
And my guess is you probably won't see this come up on an interview and if you do you can talk about
scheduled tasks you can talk about adding a user and just kind of understand what these are.
But I really do doubt that you're gonna be asked to do this on a majority of your assessments.
So that's it for this lesson.
We're gonna go ahead and move on to pivoting and then we'll talk about cleanup and we'll be done.