Aetsu/OffensivePipeline

Tool not generating output despite successful execution

Opened this issue · 1 comments

After successfully compiling OffensivePipeline using VS2022 and Buildtools 2022, I attempted to download and obfuscate a tool using the command .\OffensivePipeline.exe t sqlclient as an example.
However, the tool does not generate any output files in the SqlClient_epzktg4zle1 directory despite receiving a successful output - (https://pastebin.com/UPGXPck7)

[+] Loading tool: SqlClient
    Clonnig repository: SqlClient into C:\Users\Doxi\Desktop\Dev\OffensivePipeline-main\OffensivePipeline\bin\Release\net6.0\Git\SqlClient
                 Repository SqlClient cloned into C:\Users\Doxi\Desktop\Dev\OffensivePipeline-main\OffensivePipeline\bin\Release\net6.0\Git\SqlClient

    [+] Load RandomGuid module
        Searching GUIDs...
                > C:\Users\Doxi\Desktop\Dev\OffensivePipeline-main\OffensivePipeline\bin\Release\net6.0\Git\SqlClient\SqlClient.sln
                > C:\Users\Doxi\Desktop\Dev\OffensivePipeline-main\OffensivePipeline\bin\Release\net6.0\Git\SqlClient\SqlClient.csproj
                > C:\Users\Doxi\Desktop\Dev\OffensivePipeline-main\OffensivePipeline\bin\Release\net6.0\Git\SqlClient\Properties\AssemblyInfo.cs
        Replacing GUIDs...
                File C:\Users\Doxi\Desktop\Dev\OffensivePipeline-main\OffensivePipeline\bin\Release\net6.0\Git\SqlClient\SqlClient.sln:
                        > Replacing GUID 4122c017-5876-4aba-b836-2cb37208032a with 1adb4c79-3ddd-4071-a91b-9d1f5839ad72
                        > Replacing GUID FAE04EC0-301F-11D3-BF4B-00C04F79EFBC with 38c25674-afbb-4455-868c-696ee038b86a
                        > Replacing GUID 4122C017-5876-4ABA-B836-2CB37208032A with 37369baa-0dcc-405d-8f0b-1c3036957093
                        > Replacing GUID 26E7E7D5-4464-4DEB-A636-B4B4DC0726D3 with 39001d91-4076-4060-b972-eac1874fa405
                [+] No errors!
                File C:\Users\Doxi\Desktop\Dev\OffensivePipeline-main\OffensivePipeline\bin\Release\net6.0\Git\SqlClient\SqlClient.csproj:
                        > Replacing GUID 4122c017-5876-4aba-b836-2cb37208032a with 1adb4c79-3ddd-4071-a91b-9d1f5839ad72
                        > Replacing GUID FAE04EC0-301F-11D3-BF4B-00C04F79EFBC with 38c25674-afbb-4455-868c-696ee038b86a
                        > Replacing GUID 4122C017-5876-4ABA-B836-2CB37208032A with 37369baa-0dcc-405d-8f0b-1c3036957093
                        > Replacing GUID 26E7E7D5-4464-4DEB-A636-B4B4DC0726D3 with 39001d91-4076-4060-b972-eac1874fa405
                [+] No errors!
                File C:\Users\Doxi\Desktop\Dev\OffensivePipeline-main\OffensivePipeline\bin\Release\net6.0\Git\SqlClient\Properties\AssemblyInfo.cs:
                        > Replacing GUID 4122c017-5876-4aba-b836-2cb37208032a with 1adb4c79-3ddd-4071-a91b-9d1f5839ad72
                        > Replacing GUID FAE04EC0-301F-11D3-BF4B-00C04F79EFBC with 38c25674-afbb-4455-868c-696ee038b86a
                        > Replacing GUID 4122C017-5876-4ABA-B836-2CB37208032A with 37369baa-0dcc-405d-8f0b-1c3036957093
                        > Replacing GUID 26E7E7D5-4464-4DEB-A636-B4B4DC0726D3 with 39001d91-4076-4060-b972-eac1874fa405
                [+] No errors!


    [+] Load RandomAssemblyInfo module
        Replacing strings in C:\Users\Doxi\Desktop\Dev\OffensivePipeline-main\OffensivePipeline\bin\Release\net6.0\Git\SqlClient\Properties\AssemblyInfo.cs
                [assembly: AssemblyTitle("SqlClient")] -> [assembly: AssemblyTitle("n0gdi31hbk0")]
                [assembly: AssemblyDescription("")] -> [assembly: AssemblyDescription("")]
                [assembly: AssemblyConfiguration("")] -> [assembly: AssemblyConfiguration("")]
                [assembly: AssemblyCompany("")] -> [assembly: AssemblyCompany("")]
                [assembly: AssemblyProduct("SqlClient")] -> [assembly: AssemblyProduct("n0gdi31hbk0")]
                [assembly: AssemblyCopyright("Copyright c  2020")] -> [assembly: AssemblyCopyright("Copyright c  2018")]
                [assembly: AssemblyTrademark("")] -> [assembly: AssemblyTrademark("")]
                [assembly: AssemblyCulture("")] -> [assembly: AssemblyCulture("")]


    [+] Load BuildCsharp module
        [+] Checking requirements...
                [+] Download OK - nuget.exe
                [+] Path found - C:\Program Files (x86)\Microsoft Visual Studio\2022\BuildTools\Common7\Tools\VsDevCmd.bat
        Solving dependences with nuget...
        Building solution...
                [+] No errors!
                [+] Output folder: C:\Users\Doxi\Desktop\Dev\OffensivePipeline-main\OffensivePipeline\bin\Release\net6.0\Output\SqlClient_epzktg4zle1


    [+] Load ConfuserEx module
        [+] Checking requirements...


    [+] Load Donut module


    [+] Generating Sha256 hashes
                Output file: C:\Users\Doxi\Desktop\Dev\OffensivePipeline-main\OffensivePipeline\bin\Release\net6.0\Output\SqlClient_epzktg4zle1


-----------------------------------------------------------------
                SUMMARY

 - SqlClient
         - RandomGuid: OK
         - RandomAssemblyInfo: OK
         - BuildCsharp: OK
         - ConfuserEx: OK
         - Donut: OK

-----------------------------------------------------------------

I also tried to download and execute the file from the releases, but no output was generated as well (I have disabled Windows Defender to eliminate any possible interference).

  • Sysinfo
OS Name:                   Microsoft Windows 10 Pro
OS Version:                10.0.18362 N/A Build 18362
OS Manufacturer:           Microsoft Corporation
OS Configuration:          Standalone Workstation
OS Build Type:             Multiprocessor Free

Any ideas?
Thanks a lot :)

r4ti0 commented

I had the same issue and managed to find the cause and a possible solution:

When the program gets to line 104 in BuildCsharp.cs, the buildSolution.bat file is executed, which contains the msbuild.exe command and its parameters. In case of some tools (like sqlclient), where the target .NET framework is older (for example 4.0), the msbuild fails "silently" with the following:
"The reference assemblies for .NETFramework,Version=v4.0" were not found."

In other words, the error message is simply added to the "standard output" instead of "standard error" and there is no exception raised either. As a result, ExecuteCommand(batPath) returns true as status and the if statement evaluates to false, which causes the execution flow to jump to line 114, saying that there were "No errors".
Since the build failed, there was no file created in the output folder and of course, there was nothing to obfuscate.

The issue can be solved by editing the OffensivePipeline/App.config file so that the BuildCsharpOptions contains a newer target framework version (/p:TargetFrameworkVersion=4.8), like this:
<add key="BuildCsharpOptions" value="/p:TargetFrameworkVersion=4.8 /p:LangVersion=latest /p:Platform=&quot;Any CPU&quot; /p:Configuration=Release /p:AllowUnsafeBlocks=true"/>