logo

Use of Software with Known Vulnerabilities - Elixir


Need

Prevent exploitation of known vulnerabilities in dependencies


Context

  1. Usage of Elixir (1.10 and above) for building scalable and fault-tolerant applications
  2. Usage of mix for dependency management

Description

Insecure Code Example

defp deps do
  [{:phoenix, '~> 1.2.1'}]
end

The insecure code example demonstrates the use of an outdated and potentially vulnerable version of the Phoenix framework (1.2.1), as specified in the mix.exs file in an Elixir project. Known vulnerabilities exist in this version of the Phoenix framework that can be exploited by attackers.

Steps

  1. Identify the dependencies and their versions that are known to have vulnerabilities.
  2. Search for the latest versions or the safe versions of those dependencies.
  3. Update the dependency specifications in your mix.exs file.
  4. Run 'mix deps.update --all' to update the dependencies.

Secure Code Example

defp deps do
  [{:phoenix, '~> 1.5.7'}]
end

In the secure code example, the Phoenix framework has been updated to a more recent and secure version (1.5.7). This version does not have the vulnerabilities present in the older version.


References

  • 011 - Use of Software with Known Vulnerabilities

  • Last updated

    2023/09/18