Skip to content
This repository was archived by the owner on Aug 18, 2018. It is now read-only.
This repository was archived by the owner on Aug 18, 2018. It is now read-only.

Security considerations #41

Open
Open
@gdelugre

Description

@gdelugre

Hi guys,

I am the developer of a PDF manipulation framework (Origami) and I'm currently trying to integrate Johnson into it.
My project is oriented on malicious PDF documents analysis for exploit analysts/writers. As many PDF exploits make use of embedded JavaScript code, being able to run the code in a clean and safe SpiderMonkey engine would be very nice.

I have started reimplementing the Adobe JavaScript API with Johnson, binding the calls to my PDF engine internals and it seems to work very nicely. However, I am running into one problem : the JavaScript code to be run is supposed to be totally untrusted, and as such it should not be possible to escape from the SpiderMonkey engine.

It is currently very easy to escape from JavaScript for two reasons:

  1. The Ruby Object namespace is directly included in the global scope.
  2. It is possible to make calls on internal Ruby methods from JavaScript.

For instance from JS:

js> Ruby.File.read("/etc/passwd")

If util is a defined Ruby Object accessible in JS scope:

js> util.send("system","/bin/sh")

Could it be possible that you introduce some sort of flag to prevent the Ruby Object namespace to be included in global ?
Maybe also introduce some checks so that only user-defined methods are accessible from JS ?

I am not very familiar with your code base, but I was thinking about including those security checks into JSLandProxy::send_with_possible_block and modifying Runtime#initialize.

Would that be OK for you?

Thanks,
Guillaume Delugré

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions