September 16th, 2024

Attacking PowerShell Clixml Deserialization

PowerShell's CLIXML deserialization presents security risks, including remote code execution. The article discusses vulnerabilities, gadget chains, and offers recommendations for IT operations and developers to mitigate these risks.

Read original articleLink Icon
Attacking PowerShell Clixml Deserialization

The article discusses the security risks associated with PowerShell's CLIXML deserialization, which can lead to vulnerabilities such as remote code execution. It highlights that common PowerShell functionalities, including PowerShell Remoting and PowerShell Direct, depend on this deserialization process, making them susceptible to attacks. The author, Alexander Andersson, submitted research to the Microsoft Security Response Center, which acknowledged the issue but noted that the attack vector remains viable. The article provides a technical overview of deserialization, explaining how serialized data can be exploited through crafted "gadget chains" that trigger harmful function calls. It also details the differences between property bags and rehydrated objects in PowerShell, emphasizing the security implications of deserializing untrusted data. The author references previous research on deserialization attacks and outlines specific types that can be exploited, particularly focusing on ScriptBlock rehydration and its implications for security. The article concludes with recommendations for IT operations and PowerShell developers to mitigate these risks.

- PowerShell's CLIXML deserialization poses significant security risks, including remote code execution.

- Common PowerShell functionalities are vulnerable due to reliance on deserialization processes.

- The article discusses the concept of gadget chains used in deserialization attacks.

- Differences between property bags and rehydrated objects are crucial for understanding security implications.

- Recommendations are provided for mitigating risks associated with CLIXML deserialization.

Link Icon 3 comments
By @a1a - 5 months
Wow, this is a Hyper-V breakout! I am amazed that it's 2024 and we still have problems with basic input validation.
By @kojiphilippines - 5 months
The thing I love about powershell is that you don't have to learn any DSLs, unlike bash, zsh, and the like. Want to manipulate some structured text data? Convert it to a native object, modify it using powershell syntax, and convert it back to the original data format. If you want to do this in bash, you have to learn the syntax and parameters for many utilities like jq, awk, starletxml, and many others. Also, unlike bash, you can use the output of commands like ls directly without worrying that some characters might break your code, as is the case with bash/zsh. You can also easily create whole UI windows in PowerShell and do some other complicated things that are barely possible in bash. Some people complain that cmdlets are too long to write, but you can just write the first letters of each command, e.g. Get-ChildItem -> gci, and it will do the work. Also, everything is much more standardized than in bash, which makes it easier to learn the scripting language.