CVE-2026-130411 in flop
Summary
by MITRE • 11/24/2026
Deserialization of Untrusted Data vulnerability in woylie flop allows a remote attacker to execute code on the server via a crafted pagination cursor.
Flop.Cursor.decode/2 in lib/flop/cursor.ex decodes the after and before parameters with :erlang.binary_to_term/2 in :safe mode. Its check rejects functions, PIDs, ports and references, but it accepts maps, and therefore structs of any module. Flop passes the decoded values to Ecto as query parameters. A cursor value that nests an Ecto.Query.DynamicExpr struct with a DBConnection.Stream struct as its binding fails the Ecto cast. Ecto then inspects the value for the error message, the Inspect implementation enumerates the stream, and DBConnection calls the module, function and arguments in the :log option of the stream.
This issue affects flop: from 0.8.0 before 0.26.7, from 0.27.0 before 0.27.3, from 0.28.0 before 0.28.1, and from 0.29.0 before 0.29.2.
If you want to get best quality of vulnerability data, you may have to visit VulDB.
Analysis
by VulDB Data Team • 11/24/2026
The vulnerability identified in the woylie flop library represents a critical deserialization of untrusted data flaw that enables remote code execution on affected servers. This security issue stems directly from the implementation of the Flop.Cursor.decode/2 function located within lib/flop/cursor.ex, which is responsible for parsing pagination cursors provided by clients via after and before query parameters. While the library implements a safety check intended to reject dangerous Erlang terms such as functions, PIDs, ports, and references, it erroneously accepts maps and consequently any struct of an arbitrary module. This permissive validation allows attackers to inject malicious data structures into the application's processing pipeline under the guise of legitimate pagination metadata.
The exploitation chain leverages a specific interaction between Flop, Ecto, and DBConnection to achieve code execution. An attacker crafts a cursor value that nests an Ecto.Query.DynamicExpr struct containing a DBConnection.Stream struct as its binding parameter. When this malicious structure is passed to Ecto for query processing, the standard casting mechanism fails because the nested stream object does not conform to expected types. However, rather than simply returning an error and halting execution, Ecto proceeds to inspect the invalid value to generate a descriptive error message. This inspection process triggers the Inspect protocol implementation associated with the DBConnection.Stream struct.
The critical security failure occurs within this inspection phase. The Inspect implementation for the stream object enumerates its contents, which inadvertently causes DBConnection to invoke the module, function, and arguments specified in the :log option of the stream structure. By carefully crafting the nested structs, an attacker can manipulate these log options to execute arbitrary Erlang code on the server side during this error handling routine. This mechanism effectively bypasses the initial safety checks because the malicious payload is not executed directly by Flop but rather triggered indirectly through Ecto's debugging and inspection logic when processing a malformed query parameter.
This vulnerability aligns with CWE-502, which describes deserialization of untrusted data, as well as CWE-94, code injection via improper control sequence handling. In the context of the MITRE ATT&CK framework for enterprise security, this attack vector corresponds to techniques involving input validation bypass and potentially command execution through application logic flaws. The impact is severe, allowing a remote attacker who can submit crafted HTTP requests with manipulated pagination cursors to gain arbitrary code execution capabilities on the backend server, potentially leading to full system compromise, data exfiltration, or denial of service depending on the privileges granted by the executed code.
The issue affects multiple versions of the flop library across different release branches. Specifically, it impacts version 0.8.0 up to but not including 0.26.7, version 0.27.0 up to but not including 0.27.3, version 0.28.0 up to but not including 0.28.1, and version 0.29.0 up to but not including 0.29.2. Organizations running any of these affected versions are at risk unless they apply the appropriate patch or upgrade to a fixed release where the deserialization logic has been hardened to strictly validate all nested structures and prevent the execution of arbitrary code during error inspection routines. Mitigation strategies should prioritize upgrading to the latest stable version that includes fixes for this specific cursor decoding vulnerability, ensuring that input validation is rigorous across all accepted data types including maps and structs.