Skip to content

Commit 0572c07

Browse files
authored
Update Visual C++ Runtime auditing guide
1 parent 79fe7d2 commit 0572c07

File tree

1 file changed

+44
-59
lines changed

1 file changed

+44
-59
lines changed

docs/windows/redist-version-auditing.md

Lines changed: 44 additions & 59 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
---
2-
title: "cpp-redist-version-auditing"
3-
description: "This article provides a detailed guide for auditing usage of Visual C++ Runtime versions within your organization."
2+
title: "How to audit Visual C++ Runtime version usage"
3+
description: "A detailed guide for auditing Visual C++ Runtime file usage."
44
ms.date: 12/2/2024
55
helpviewer_keywords:
66
[
@@ -11,89 +11,74 @@ author: MahmoudGSaleh
1111
ms.author: msaleh
1212
---
1313

14-
# How to audit Visual C++ Runtime version usage within your organization
14+
# How to audit Visual C++ Runtime version usage
1515

16-
The Microsoft Visual C++ Redistributable and the Visual Studio C++ Runtime (collectively, "VC Runtime") are critical components to thousands of applications. Across your enterprise network, machines may still be running applications that install and use an out-of-support version of the VC Runtime. NTFS File Auditing can be used to identify such usage as a step towards helping you replace these applications with ones that take a dependency on a supported version of the VC Runtime. This guide will walk you through setting up NTFS File Auditing, provide troubleshooting tips, and highlight the benefits of regular audits.
16+
The Microsoft Visual C++ Redistributable and the Visual Studio C++ Runtime (collectively, "VC Runtime") are critical components of many applications. Across your network, machines may still be running applications that install and use an out-of-support version of the VC Runtime. You can use NTFS File Auditing to identify such usage as a step towards helping you replace these applications with ones that take a dependency on a supported version of the VC Runtime. This guide walks you through setting up NTFS File Auditing, provided troubleshooting tips, and highlights the benefits of regular audits.
1717

18-
For details on the versions of VC Runtime no longer supported, see [Microsoft Visual C++ Redistributable latest supported downloads](/cpp/windows/latest-supported-vc-redist).
18+
For more information about the versions of VC Runtime that are no longer supported, see [Microsoft Visual C++ Redistributable latest supported downloads](/cpp/windows/latest-supported-vc-redist).
1919

20-
## Enabling NTFS File Auditing to determine usage of VC Runtime
20+
## Enable NTFS file auditing to determine VC Runtime usage
2121

22-
NTFS File Auditing can be used to determine which process is calling VC Runtime files. You can use this information on machines with legacy versions of the VC Runtime already installed to determine which applications are calling the unsupported versions of the VC Runtime.
22+
You can use NTFS file auditing to determine which applications are calling the unsupported versions of the VC Runtime.
2323

24-
This guide will first provide steps to manually enable NTFS File Auditing and review logs. Because there are several component files that can be used by an application, this guide also shows how to use PowerShell's [Get-Acl](/powershell/module/microsoft.powershell.security/get-acl) and [Set-Acl](/powershell/module/microsoft.powershell.security/set-acl) cmdlets to update Auditing permissions. For details on how to configure the audit policies on a file, see [Apply a basic audit policy on a file or folder.](/previous-versions/windows/it-pro/windows-10/security/threat-protection/auditing/apply-a-basic-audit-policy-on-a-file-or-folder)
24+
This guide provides the steps to manually enable NTFS file auditing and review audit events. Because there are several files that can be used by an application, this guide also shows how to use PowerShell's [`Get-Acl`](/powershell/module/microsoft.powershell.security/get-acl) and [`Set-Acl`](/powershell/module/microsoft.powershell.security/set-acl) cmdlets to update auditing permissions. For more information about how to configure audit policies for a file, see [Apply a basic audit policy on a file or folder.](/previous-versions/windows/it-pro/windows-10/security/threat-protection/auditing/apply-a-basic-audit-policy-on-a-file-or-folder)
2525

2626
### Manually enable object access auditing on the system
2727

28-
Object access must be enabled before you enable file level auditing.
28+
Object access must be enabled before you enable file level auditing:
2929

30-
1. Open Group Policy: Press Windows + R to open the **Run** dialog , type `gpedit.msc`, and press Enter.
31-
2. Navigate to **Computer Configuration** > **Windows Settings** > **Security Settings** > **Advanced Audit Policy Configuration** > **System Audit Policies** > **Object Access**.
32-
3. Double-click on **Audit File System**. In the **Audit File System Properties** dialog, select **Configure the following audit events**, select **Success** and then select **OK**.
33-
4. Close the Group Policy Editor app
30+
1. Open Group Policy by pressing Windows + R to open the **Run** dialog, then type `gpedit.msc`, and press Enter.
31+
1. Navigate to **Computer Configuration** > **Windows Settings** > **Security Settings** > **Advanced Audit Policy Configuration** > **System Audit Policies** > **Object Access**.
32+
1. Double-click **Audit File System**. In the **Audit File System Properties** dialog, select **Configure the following audit events** > **Success** > **OK**.
33+
1. Close the Group Policy Editor.
3434

35-
Alternatively, you may use auditpol.exe to enable object access.
35+
Alternatively, you may use `auditpol.exe` to enable object access:
3636

3737
1. List the current settings with `AuditPol.exe /get /category:"Object Access"`.
38-
2. Enable/Disable with `AuditPol.exe /set /category:"Object Access" /subcategory:"File System" /success:enable`.
38+
1. Enable access with `AuditPol.exe /set /category:"Object Access" /subcategory:"File System" /success:enable`.
3939

4040
### Manually enable auditing on a file
4141

42-
To monitor which process is accessing a VC Runtime file, enable auditing on the file.
42+
To monitor which process accesses a VC Runtime file, enable auditing on the file:
4343

44-
1. Right-click on the file that you want to audit, select **Properties**, and then select **Security** tab.
44+
1. Right-click on the file that you want to audit, select **Properties**, and then select the **Security** tab. For more information about finding installed VC Runtime files, see [VC Runtime installed locations](#vcruntime_install_location).
45+
1. Select **Advanced**.
46+
1. In the **Advanced Security Settings** dialog box, select the **Auditing** tab and then select **Continue**.
47+
1. To add a new auditing rule, select **Add**. In the **Auditing Entry** dialog, select a principal, then type the name of the user or group you want to add such as **(Everyone)**, and then select **OK**.
48+
1. In **Type**, select ensure that **Success** is selected.
49+
1. Select **Show advance permissions** > **Clear all** > **Traverse folder / execute file** > **OK**.
50+
1. There should now be a new row in the **Auditing** entries matching what you have selected. Select **OK**.
51+
1. In the **Properties** Dialog, select **OK**.
4552

46-
* See the section below [VC Runtime installed locations](#vcruntime_install_location) to find the VC Runtime files installed on a machine.
47-
48-
2. Select **Advanced**.
49-
50-
3. In the **Advanced Security Settings** dialog box, select **Auditing** tab and then select **Continue**.
51-
52-
4. To add a new auditing rule, select **Add**. In the **Auditing Entry** dialog, select a principal, then type the name of the user or group you want to add (Everyone) and then select OK.
53-
54-
5. In the Type box, use the default of **Success**.
55-
56-
6. Select **Show advance permissions**, select **Clear all** and then select **Traverse folder / execute file**, and select **OK**.
57-
58-
7. At this point there should be a new row in the **Auditing** entries matching what you have selected. Select **OK**.
59-
60-
8. In the **Properties** Dialog, select **OK**.
61-
62-
The audit rule is enabled now.
53+
The audit rule is now enabled.
6354

6455
### Manually review audit logs
6556

66-
NTFS File Auditing will generate ["Event 4663: An attempt was made to access an object"](/previous-versions/windows/it-pro/windows-10/security/threat-protection/auditing/event-4663) for each file that includes + audit permission and the+ process accessing process namethe file.
57+
NTFS file auditing generates ["Event 4663: An attempt was made to access an object"](/previous-versions/windows/it-pro/windows-10/security/threat-protection/auditing/event-4663) for each file that includes the audit permission and that is accessed by a process.
6758

68-
1. Open Event Viewer: Press Windows + R to open the **Run** dialog , type `eventvwr.msc`, and press Enter.
69-
70-
2. Navigate to Security Logs: In the Event Viewer, expand Windows Logs and select **Security**. The results pane lists individual security events.
71-
72-
3. Filter and Analyze the Logs: Use the **Filter Current Log** option to narrow down the events to Event ID 4663 (Audit Success for the File System Category).
59+
1. Open the Event Viewer by pressing `Windows` + `R` to open the **Run** dialog. Then type `eventvwr.msc`, and press Enter.
60+
1. Navigate to the **Security** logs in the Event Viewer by expanding **Windows Logs** > **Security**. The results pane lists security events.
61+
1. Filter and Analyze the logs by choosing **Filter Current Log...** in the **Actions** pane. Narrow down the events to **Event ID 4663 (Audit Success for the File System Category)** by entering **4663 into the Includes/Excludes Event IDs** text box.
7362

7463
For an example of a File Access Auditing Event 4663, see ["4663(S): An attempt was made to access an object."](/previous-versions/windows/it-pro/windows-10/security/threat-protection/auditing/event-4663)
7564

7665
![Event Viewer showing security logs](media/windows-events.png)
7766

78-
### Using PowerShell to enable auditing of VC Runtime usage
79-
80-
The general workflow for updating the File Auditing Permissions with PowerShell is as follows:
81-
82-
1. Define the [file system audit rule](/dotnet/api/system.security.accesscontrol.filesystemauditrule.-ctor) to be applied to the file(s).
67+
### Use PowerShell to audit VC Runtime usage
8368

84-
2. Obtain a file's security descriptor with [Get-Acl](/powershell/module/microsoft.powershell.security/get-acl).
69+
To update File Auditing Permissions with PowerShell:
8570

86-
3. [Apply the audit rule](/dotnet/api/system.security.accesscontrol.filesystemsecurity.setaccessrule) to the security descriptor.
71+
1. Define the [file system audit rule](/dotnet/api/system.security.accesscontrol.filesystemauditrule.-ctor) to apply to the file(s).
72+
1. Obtain a file's security descriptor with [`Get-Acl`](/powershell/module/microsoft.powershell.security/get-acl).
73+
1. [Apply the audit rule](/dotnet/api/system.security.accesscontrol.filesystemsecurity.setaccessrule) to the security descriptor.
74+
1. Apply the updated security descriptor on the original file with [`Set-Acl`](/powershell/module/microsoft.powershell.security/set-acl).
75+
1. View File Access Auditing Event 4663 records with [`Get-WinEvent`](/powershell/module/microsoft.powershell.diagnostics/get-winevent).
8776

88-
4. Apply the updated security descriptor on the original file with [Set-Acl](/powershell/module/microsoft.powershell.security/set-acl).
77+
### PowerShell: Audit out-of-support VC Runtime files
8978

90-
5. View File Access Auditing Event 4663 records with [Get-WinEvent](/powershell/module/microsoft.powershell.diagnostics/get-winevent).
79+
The following PowerShell code enables you to audit installed VC Runtime files that are no longer supported.
9180

92-
### PowerShell: Enable auditing on out-of-support VC Runtime files
93-
94-
The following PowerShell section of code will enable usage auditing of the currently installed out-of-support VC Runtime files.
95-
96-
```sh
81+
```powershell
9782
function Get-AuditRuleForFile {
9883
$auditRuleArguments = 'Everyone' <# identity #>,
9984
'ExecuteFile, Traverse' <# fileSystemRights #>,
@@ -138,13 +123,13 @@ ForEach-Object {
138123
}
139124
```
140125

141-
### PowerShell: Viewing file auditing events
126+
### PowerShell: View file audit events
142127

143128
PowerShell provides `Get-WinEvent` to obtain event records for various event logs.
144129

145-
The following PowerShell section of code will list all of the Auditing Event 4663 records over the past 24 hours.
130+
The following PowerShell code lists all of the Auditing Event 4663 records over the past 24 hours:
146131

147-
```sh
132+
```powershell
148133
function Get-AuditEntries {
149134
param (
150135
[Parameter(Mandatory = $true)]
@@ -171,9 +156,9 @@ function Get-AuditEntries {
171156
Get-AuditEntries -oldestTime (Get-Date).AddHours(-24)
172157
```
173158

174-
Example output from the above block of code is as follows:
159+
Example output from the previous code:
175160

176-
```
161+
```output
177162
TimeCreated : 11/20/2024 5:00:11 AM
178163
Accesses : Execute/Traverse
179164
SubjectUserSid : \*\*\*\*\*

0 commit comments

Comments
 (0)