Remote code execution in Elixir-based Paginator
The Paginator library deserialised untrusted user-supplied cursors using Erlang's binary_to_term, allowing an attacker to embed an anonymous function that Elixir would later execute. This could lead to remote code execution on servers using the library.
alphabot.com
Published on alphabot.com
In August of this year I found a remote code execution vulnerability in the Elixir-based Paginator open-source project from Duffel (a UK-based startup in the flight searching space). The vulnerability has the CVE number CVE-2020-15150 assigned.
The full write-up lives on its author's site
It belongs to its author, so we link to it rather than copy it. The other two tabs are our own rewrites, checked against it.
Not written yet. The AI write-up for this write-up has not been written yet. The Original tab links to the source.
How it worked
Impact
An attacker could execute arbitrary code on servers using the Paginator library, potentially compromising Duffel's cloud assets.
What the attacker needed
API uses Paginator with user cursors
The fix
The vulnerability was fixed by Duffel in less than one day.
How it was found
- Create a Base64-encoded Erlang term containing an anonymous function to execute.
- Send this as the before or after cursor to an API using Paginator.
- The server deserialises the cursor and later calls the function via Enum.zip.
Explained by bugbounty.wiki with AI from the original and checked against quotes from it; it can still be wrong. Read the original before relying on a detail.
Not written yet. The AI write-up for this write-up has not been written yet. The Original tab links to the source.
The library took a cursor string from the user and turned it back into an internal data structure without checking it was safe. Because of how Elixir works, a hidden function inside that data could be run automatically, letting an attacker run their own code on the server.
What is RCE?
Running the attacker's code on the target's servers: through command or code injection, unsafe deserialisation or template injection.