Software Restiction Policies – Windows GPOL

I hope you are enjoying your day.  Perhaps you found yourself in a pickle with malware and need to finally implement a software restriction policy on your Windows Domain.  Considering the items in question, I am presuming and hoping you have a Group Policy on your side to help manage these machines and users.  Software Restriction Policies (SRP) are here to help you out.

Great!  Since you are looking to add a restrictive group policy, I would suggest making a test OU (Object Unit – I will only define acronyms once) and creating GPO (Group Policy Object).  With your Test OU and user account, I would suggest a VM (Virtual Machine) with that user account having minimal level domain access (Group: Domain Users).  Making our new policy, you want to focus on the following tree of your new policy.

Computer Configuration | Windows Settings | Security Settings | Software Restrictions

Brief pause here.  Respect to SwiftOnSecurity for bringing this conversation up recently on Twitter.  My guide is based from Branko Vucinec’s SRP Guide.  There is also a guide I will link below, that is for when you realize your policy also prevented Admins from installing programs.  There is a fix for that too. ;)

Let’s talk about Environmental Variable Paths (EVP).  These are commonly used by installers and scripters for installing, both legitimate and exploit code & applications.  Ones I am focusing in are:

>@echo %appData%

>@echo %localAppData%

>@echo %temp%

>@echo %tmp%

Echo shows us we have the right file paths and how they output per the active user account.  As noted, we are looking to restrict some access to items in these folders executing.  Along with that, we have some extensions to focus on restricting.  The linked guide covers, while I also add:

  • Archives (7z, zip, rar)
  • EXE
  • JAR
  • MSI
  • VBS
  • COM
  • BAT
  • PS1

Wild list, with some oldies on there.  Let’s just say, you can lots of automation with .bat files.  Everything else listed has more capabilities than that, but if you can call something else from a batch, there are options from there.  This is not meant as an exhaustive stop-all-exploit execution solution!  Honestly nothing really is (and if someone says so, they are lying).  This is about presenting extra layers to prevent exploits from ‘getting the keys to your castle’ in respect to infrastructure.
This is getting wordy on the backdrop narrative… Let’s get going here.  Time to make the policy.
Making our new GPO, jump into the tree and Right-click on SRP then click New Software Restriction Policy.
Under Additional Rules, add our Disallowed exceptions.  These being the EVP list of folders I noted above.  An example being “%temp%*.exe”
We add these by making a New Path Rule.
I could lie to you here, but you have quite a few to add.  Branko’s Guide covers the syntax while my extension list adds other possibilities.  Make the call what is most probable on your network and what you may have seen in attack patterns.  Besides, you are one of the people who has to test this, and ideally one of the 1st to do so… so you can eliminate the immediate conflicts with business operations, before anyone else can try to prevent the implementation from happening.
Good Job.  Now that you finished your new GPO, add your test machine into the linked OU with that policy and have your test account login on said VM or test desktop.  Try to do some standard fare user operations and software patching.  Install Firefox, update Flash, whatever you or anyone else might do on a frequent basis.  If you managed to remove flash from your network.  Give yourself a high-five.
Ok now try to install some software as an Administrator.  In this case, Firefox will fail because it extracts the installer to %localAppData%.  Turns out your policy also applies to Local and Domain Administrators logged into that machine.  Good thing we are testing before launching live, huh?
To resolve this, we are jumping back into that policy you just made.  We need to add an Enforcement exception for Administrators.  The Policy path for that is:

Computer Configuration | Windows Settings | Security Settings | Enforcement

On the Enforcement settings, you will see Apply software restriction policies to the following users: Go ahead and in this middle section, set the radio dot to All users except local administrators MS KB on Enforcement.
Hit OK, Close your policy, jump back onto your VM and run another ‘gpupdate’ command to get the latest policy on that machine.
Diagnostic Note: If you have questions if the policy is actually applying, run RSOP.msc and see the Resultant Set of Policy.  These details will show you what options are set by all GPOs and what one is defining the settings.
Try running that installer again, but this time right-click it and do a Run as Administrator.  It will prompt if you are not logged in with an admin-level account, else it will just run.  Your installer should now properly execute.  In addition and most of all, rouge applications matching your filter rule list, should not be able to run.  The protections are only as good as your rules, so keep an eye out for what applicable stops you can build to protect your network from processes gone awry.


Ansible and Vagrant. DevOps acronym decoded

Let me start by saying Ive lived the System Admin life for quite some time. The decoding title is in reference to:
Installing, deploying, configuring, and monitoring servers in a rapid deployment manner.
Most important of all, in a non-static and non-fragile manner. TL;DR security – Running services across multiple servers, that can be shut down in the event of intrustion or broken configuration and replaced with a new image with all the required configuration, out the gate on your reployment.
You will be communicating and deploying over SSH sessions, so encrypted communcations are how you ‘make the magic happen’.

Here are some notes I took from a great presentation by Chris Rossi of AppliedTrust, that also got me running my own deployments. I am also working from the following book: Absible for DevOps by Jeff Geerling.

As this is a technical and video game heavy site, Im sure many visitors and members know the struggle of single-thread processes not scaling your gaming hardware. By deploying your server topology with Ansible (Python based) and Vagrant (Ruby syntax) scripting, you get a performance scalable topology, where services can be allocated per Virtual Machine; while also being able to be replaced by a fresh spun VM, in the event of misconfiguration change or security exploit. You also get some botnet-like controls to distribute commands across all or selected servers in your Vagrant configuration.

Personally, I have been learning Python to make tools to assist me in log crawling functions, configuration and other data driven projects. I legit feel like Ansible and Vagrant usage has progressed me beyond making bash script, as the state control / config deployment and validation is light-years beyond cobbling my own scripts from scratch. I have been exploring this for less than a week, so please excuse the details thus far. However I will say this knowledge is really addictive, since I am seeing my personal projects materialized in a deliverable, community cooperative platform of Ansible using Vagrant.

Borrowing from Chris’s presentation, patch deployment and distributing content is the final leg / deliverable of the DevOps process. Considering I am used to living a Windows SysAdmin life with the use of windows cmd and Linux scripting, this point resonates as solid truth in the compliance being the hardest deliverable, while being consistent. Did I mention scaling your network and sever topology? Because that is what you are up to with deploying dynamic servers in a VM environment. Get the most performance per service to VM, with added benefit of essentially real-time monitoring. In the event of a fault, you can also handle the decommission and re-launching of a new, compliant VM in the event of mis-config change / exploit.


Weather talk

The weather is fairly cold locally for the season, but an extra layer is not a bother. So more apt a conversation is security. Without a ton of hyperbole and a flood of links, usage and personal information is why you are seeing most everyone using ‘free services’.  Social relationships are spiking because the technology boom is completely breaking social comprehension of the world they live in.

Why is something being stored relating to what can be found?  The sickness of it is how much marketing is everyday.  If you do not seek out various opinions about, really any matter you seriously have concern about… is frankly, ignorant.  Researching can be exhausting, but if you rely on bias you are facilitating that.  Secure things and work with people.  Share your reason for disagreeing.  Stop imprisoning some of the smartest people for being observant.  Allowing an individual to make a non-baited opinion about what is ‘allowed’.  Maybe stop fighting, especially over text words.

Thank you for reading.  Keep thinking about your well being to help others instead of flip a power leverage trope.