Использование уязвимости Externally-Controlled Input в Select Classes или Code ('Unsafe Reflection') в elixir-ecto db_connection позволяет злоумышленнику выполнять произвольный код через поддельную структуру DBConnection.Stream или DBConnection.PrepareStream. Реализации Enumerable обеих структур в lib/db_connection.ex выполняются с параметрами, хранящимися в структуре. Опция :log принимает module, function, arguments tuple, к которому применяется DBConnection.
Когда код перечисляет поддельную структуру, DBConnection вызывает выбранную функцию. Эта проблема не может быть использована только в db_connection. Теоретически это уязвимость нисходящего компонента.
Коренная причина - это компонент, который декодирует ненадежный ввод с помощью : erlang.binary_to_term/2 и не ограничивает, какие термины содержит результат. Опция :safe не отвергает структуры, и эти структуры содержат только простые термины. Structs других библиотек может привести к тому же результату, поэтому компонент, который декодирует ненадежные термины, остается в опасности независимо от db_connection.
Эта запись существует, потому что структура использовалась при атаках на такие компоненты. Эта проблема затрагивает db_connection: от 1.1.0 до 2.10.3.
Показать оригинальное описание (EN)
Use of Externally-Controlled Input to Select Classes or Code ('Unsafe Reflection') vulnerability in elixir-ecto db_connection allows an attacker to execute arbitrary code via a forged DBConnection.Stream or DBConnection.PrepareStream struct. The Enumerable implementations of both structs in lib/db_connection.ex run with the options stored in the struct. The :log option accepts a {module, function, arguments} tuple, which DBConnection applies. When code enumerates a forged struct, DBConnection calls the chosen function. This issue is not exploitable in db_connection alone. It is, in theory, a vulnerability of the downstream component. The root cause is a component that decodes untrusted input with :erlang.binary_to_term/2 and does not restrict which terms the result contains. The :safe option does not reject structs, and these structs contain only plain terms. Structs of other libraries can possibly lead to the same result, so a component that decodes untrusted terms stays at risk independently of db_connection. This record exists because the struct was used in attacks on such components. This issue affects db_connection: from 1.1.0 before 2.10.3.
Характеристики атаки
Последствия
Строка CVSS v4.0