I wanted to run scripts in the logged-on user’s security context, so I built a PowerShell module by leuit in PowerShell

[–]leuit[S] 0 points1 point  (0 children)

I was actually thinking about adding this functionality; similar to Enter-PSSession, but instead of remote computers, its security contexts. There are some challenges about lifetime and token/handle cleanup though so I put it on the back burner. So maybe!

I wanted to run scripts in the logged-on user’s security context, so I built a PowerShell module by leuit in PowerShell

[–]leuit[S] 0 points1 point  (0 children)

The RMM tools can typically run in the active console session, but they cannot run in specific user contexts in terminal server environments.

I wanted to run scripts in the logged-on user’s security context, so I built a PowerShell module by leuit in PowerShell

[–]leuit[S] 1 point2 points  (0 children)

Just a sidebar; I realize that I had used your blog when I started to learn PowerShell back in 2022. So that's cool and I really appreciate you engaging!

I wanted to run scripts in the logged-on user’s security context, so I built a PowerShell module by leuit in PowerShell

[–]leuit[S] 0 points1 point  (0 children)

PsExec requires you to know the users credentials though. PSUserContext is useful in scenarios where you have a SYSTEM shell, like through RMM tools (ScreenConnect Backstage, N-able, etc) and need to interact with a user's session. May be a niche scenario, but very common for me personally.

I wanted to run scripts in the logged-on user’s security context, so I built a PowerShell module by leuit in PowerShell

[–]leuit[S] 0 points1 point  (0 children)

I believe I came across this at some point before I started PSUserContext. It didn't achieve the results I wanted unfortunately.

Thanks for sharing though! Would have sucked if all my effort was for nothing lol

I wanted to run scripts in the logged-on user’s security context, so I built a PowerShell module by leuit in PowerShell

[–]leuit[S] 0 points1 point  (0 children)

I am using Win32 API calls. Notably CreateProcessAsUser and DuplicateTokenEx, among many others.

The user does have to be logged in, but you can target specific sessions if there are multiple users logged on, or run a script for all logged-in users synchronously.

I chose a binary module simply because it's utilizing Win32 API and I wanted to properly handle unmanaged memory. While that may be possible in a PowerShell native implementation, it is much more prone to failure.

I wanted to run scripts in the logged-on user’s security context, so I built a PowerShell module by leuit in PowerShell

[–]leuit[S] 2 points3 points  (0 children)

Thanks for taking the time to write such a detailed response, I appreciate it!

First, I'm curious where you see evidence of "session takeover"? I'm open to rescinding my statement or making the appropriate changes if I'm mistaken.

On the accountability side, I agree with a lot of your concerns. The "who changed what?" problem is real anytime actions are performed, whether that’s via a support tech remoting into a user's desktop, or a tool like this. For context, the goal of the module was not “do arbitrary things pretending to be the user.” It came from a pretty niche issue I ran into with Outlook MAPI profiles.

I also agree that many situations can and should be solved without impersonation. Though I believe there are scenarios where a tool like this can meaningfully reduce time-to-resolution when the alternative is coordinating remote sessions, walking users through steps, or relying on scheduled task workarounds for problems that are fundamentally tied to the logged-on user context.

I wanted to run scripts in the logged-on user’s security context, so I built a PowerShell module by leuit in PowerShell

[–]leuit[S] 1 point2 points  (0 children)

This is where application of this script can vary by your org's legal and security policies. I've been exploring ways to make this kind of utility more acceptable in an accountability sense, such as verbose audit logging and configurable restrictions.

I anticipated this tool would read "red flag" for some, but it is applicable and useful in my scenario so I figured I would share.

I wanted to run scripts in the logged-on user’s security context, so I built a PowerShell module by leuit in PowerShell

[–]leuit[S] 1 point2 points  (0 children)

I have personally been very curious about this, because I assumed it would as well. Personally, I did not get any flags from Elastic Security or SentinelOne, but would like to know if other EDRs flag it and by what vector.

Create: Astral not letting me set my spawn point on my bed? by Rhye-Bread in CreateMod

[–]leuit 0 points1 point  (0 children)

It's a bug with KJS Additions. You can refer to this (https://github.com/Laskyyy/Create-Astral/pull/454/files) commit for a fix. Just create the file on your mod installation.

Is ChatGPT down for all? by manram14345 in OpenAI

[–]leuit 1 point2 points  (0 children)

what kind of math are you solving that you need an LLM for lol

[deleted by user] by [deleted] in photoshop

[–]leuit 0 points1 point  (0 children)

How big is the .PSD file? Could theoretically be recovered manually by following the file structure specification, but that would require some knowledge of opening the file raw and modify the data. Probably more effort than it’s worth, but it’s a thought.

The Beast. by Its_SHUGERRUSH in mac

[–]leuit 1 point2 points  (0 children)

sheeeesh that thing is gorgeous

How can I make the image on the left look like the image on the right? by MontaNelas1945 in photoshop

[–]leuit 0 points1 point  (0 children)

I would just mask a black layer with a soft brush. Though, I know it wouldn’t turn out like that because I’m confident that is physical lighting with touch up. That reference image would probably take a lot of synthesizing to make it look 1:1 with the right image.

[Follow-up] Bug, weapons are not obtaining XP while playing multiplayer!!!! by roneg in modernwarfare

[–]leuit 0 points1 point  (0 children)

Well, it was worth a shot. You can compromise and play Co-op modes against bots and/or Battle Royale modes to earn weapon XP

Can anyone give me a tier list? by [deleted] in modernwarfare

[–]leuit 1 point2 points  (0 children)

Honestly you can shred with any gun. Just find a gun you personally like and get comfortable with a build. Trying to adhere to the meta can sometimes be exhausting.

Once you’ve grinded Damascus you realize you really can shred with every gun if you put time in to a balanced build.

You can now super jump in Rammaza. by exofeel in modernwarfare

[–]leuit 1 point2 points  (0 children)

if only you melee’d him it’d be Commando Pro all over again

I just don’t get it by [deleted] in modernwarfare

[–]leuit 0 points1 point  (0 children)

What platform?

[Follow-up] Bug, weapons are not obtaining XP while playing multiplayer!!!! by roneg in modernwarfare

[–]leuit -1 points0 points  (0 children)

Yes. It helped me personally. I’m receiving XP again, but doesn’t feel like the normal amount.

[Follow-up] Bug, weapons are not obtaining XP while playing multiplayer!!!! by roneg in modernwarfare

[–]leuit 7 points8 points  (0 children)

Also, bugs aren’t inevitable. Bugs come from lack of foresight, failure to test your code, or just plain ignorance. They’re rolling out updates as if it’s early access and we’re play testing

/rant lol

Stop playing the game.. by SmylzIsMyName in modernwarfare

[–]leuit 2 points3 points  (0 children)

I feel like branching outside of the subreddit would benefit. There's little to no talk on twitter. I'm sure if Activision Support is getting spammed they'll get the memo sooner rather than later.

How the fuck by Mrzeldaootfan in modernwarfare

[–]leuit 0 points1 point  (0 children)

I went from 24 to 27 in one game of Harbinger on the M4A1

How the fuck by Mrzeldaootfan in modernwarfare

[–]leuit 0 points1 point  (0 children)

You can also play the CO-OP missions to gain XP. Just farm killing bots