An open API service indexing awesome lists of open source software.

https://github.com/seb1k/block-mshta-with-intune

Block outbound connections from mshta.exe using Microsoft Intune Firewall Rules
https://github.com/seb1k/block-mshta-with-intune

endpoint-security hardening intune lolbas microsoft-intune microsoft-security mitre-attack mshta secure-score windows-firewall windows-security

Last synced: 29 days ago
JSON representation

Block outbound connections from mshta.exe using Microsoft Intune Firewall Rules

Awesome Lists containing this project

README

          

# Block outbound connections for mshta.exe using Intune Firewall Rules

![Windows](https://img.shields.io/badge/Windows-10%20%7C%2011-0078D6?logo=windows)
![Intune](https://img.shields.io/badge/Microsoft-Intune-0078D4?logo=microsoft)
![Security](https://img.shields.io/badge/Security-Hardening-red)
[![MITRE](https://img.shields.io/badge/MITRE-T1218.005-red)](https://attack.mitre.org/techniques/T1218/005/)
[![LOLBAS](https://img.shields.io/badge/LOLBAS-mshta.exe-orange)](https://lolbas-project.github.io/lolbas/Binaries/Mshta/)

---
This configuration validates the Microsoft Secure Score recommendation:

> **Block outbound network connections from Microsoft HTML Application Host (`mshta.exe`)**

## Why block mshta.exe?

`mshta.exe` is frequently abused by attackers to execute malicious HTA payloads and establish outbound connections.

Blocking outbound traffic helps reduce the attack surface and improves Microsoft Secure Score compliance.

## Go to Intune > Endpoint security \| Firewall

https://intune.microsoft.com/?ref=AdminCenter#view/Microsoft_Intune_Workflows/SecurityManagementMenu/~/firewall

- **Create Policy**
image

- Platform : **Windows**
- Profile : **Windows Firewall Rules**

image

#### Basics
- Name : Block mshta.exe
- Description : Block outbound network connections from Microsoft HTML Application Host (mshta.exe)

#### Configuration Settings
- Add 2 firewall rules:
- **Block C:\Windows\SysWOW64\mshta.exe**
- **Block C:\Windows\System32\mshta.exe**
- Set the action to **Block** for both rules.
image

**Rule 1 Click Edit instance :**
- Enable : **Enabled**
- Interfaces types : **All**
- File Path: Click **Configure** → `C:\Windows\SysWOW64\mshta.exe`
image


image

**Rule 2 Click Edit instance :**
- Enable : **Enabled**
- Interfaces types : **All**
- File Path : Click **configuree** → `C:\Windows\System32\mshta.exe`
image


image

#### Scope Tags
Nothing
#### Assignments
- **All devices**
image

#### Review + create
image

## Validation

Test the policy with:

```powershell
Get-NetFirewallRule -PolicyStore ActiveStore | Where-Object {$_.DisplayName -like "*mshta*"}