Shared Memory Session Sharing

The OrionAuth library provides secure inter-process communication using Windows named shared memory to pass session data from loader to payloads.

How It Works

  1. Loader authenticates user and receives session data
  2. Loader writes session data to named shared memory segment
  3. Loader executes payload via RunPE
  4. Payload reads session data from shared memory on startup
  5. Payload knows authenticated user without separate login

Session Data Structure

struct SessionData {
    bool Valid;           // Whether data is valid
    char Username[64];    // Authenticated username
    char LicenseKey[64];  // License key used
    char UserId[16];      // User ID from database
    char LicenseId[16];   // License ID from database
    char Timestamp[32];   // Unix timestamp of session creation
    char Hwid[128];       // Hardware ID (optional)
    char ApiKey[128];     // API key (optional)
};

Loader Usage

// Write session data before executing payload
OrionAuth::SharedMemory::WriteSessionData(
    response.Username,
    response.LicenseKey,
    response.UserId,
    response.LicenseId,
    hwid,      // optional
    apiKey     // optional
);

// Execute payload
client.DownloadAndExecute(error);

// Release handle after payload starts
OrionAuth::SharedMemory::ReleaseHandle();

Payload Usage

#include "OrionAuthShared.hpp"

// Read session data on startup
auto session = OrionAuth::SharedMemory::ReadSessionData();
if (session.Valid) {
    std::cout << "User: " << session.Username << std::endl;
    std::cout << "License: " << session.LicenseKey << std::endl;
}

Implementation Notes

  • Shared memory segment name: OrionAuth_Session_v1
  • Memory persists until all handles are closed
  • Loader keeps handle open until payload starts
  • No Sleep delay needed - process creation provides enough time
  • Payload must read data immediately on startup