Skip to content

An authenticated ASPX webshell that receives base64-encoded C# code, compiles it server-side, executes it, and returns the output.

License

Notifications You must be signed in to change notification settings

joaovarelas/aspx-webshell-executor

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

2 Commits
 
 
 
 
 
 
 
 
 
 

Repository files navigation

aspx-webshell-executor

An authenticated ASPX webshell that receives base64-encoded C# code, compiles it server-side, executes it, and returns the output.

⚙️ Overview

This project consists of two components:

  • Server (ASPX/C#): A webshell that listens for incoming requests, authenticates clients, decodes base64-encoded C# source code, dynamically compiles it using the .NET runtime, and returns the execution result.
  • Client (Python): A simple CLI tool that encodes C# source code in base64, sends it to the server over HTTP, and prints the result.

This setup can be useful for controlled remote code execution scenarios, C2 development, red team tooling, or testing dynamic compilation in ASP.NET environments.


📁 Structure

aspx-webshell-executor/ │ ├── server/ │ └── webshell.aspx # The main ASPX page handling authentication and execution │ ├── client/ │ └── executor.py # Python client to encode and send C# code

🔐 Authentication

The server implements a basic authentication mechanism. Each request must include a custom header with a pre-shared token:

Authorization: SHA1(YOUR_SECRET_TOKEN)

You should modify the hardcoded token in both server and client before deploying or testing.

🚀 Usage

1. Deploy the ASPX Webshell

Host webshell.aspx on an IIS server with .NET Framework 4.x support.

Example default location:

http:///webshell.aspx

Ensure that the ASP.NET runtime has permission to compile and run dynamic code.

2. Use the Python Client

Install dependencies:

pip install requests

Then run:

python executor.py --url http://<target>/webshell.aspx --token YOUR_SECRET_TOKEN --file payload.cs

    --file: Path to the local C# source code file to send.

    The output from the remote execution will be printed to stdout.

🧪 Example Payload (payload.cs)

using System;
public class Executor {
    public string Run() {
        return "Hello from the server!";
    }
}

About

An authenticated ASPX webshell that receives base64-encoded C# code, compiles it server-side, executes it, and returns the output.

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published