Skip to content

Arbitrary module overwrite #7

@hauleth

Description

@hauleth

Example below shows how one can have arbitrary module overwrite without resolving to calling disallowed functions:

  test "rewrite MiniEixir" do
    code = """
    defmodule Foo do
      defmodule :"Elixir.MiniElixir" do
        def eval(_, _, _, _), do: :pwnd
      end

      def bar(a) do
        a
      end
    end
    """

    assert {:ok, _} = MiniElixir.eval(code, Foo, :bar, [2137])
    assert :pwnd = MiniElixir.eval(code, Foo, :bar, [2137])
  end

This will also silence any error that is happening, because of compiler options being set.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions