Descrizione
A Regular Expression Denial of Service (ReDoS) vulnerability was discovered in the Hugging Face Transformers library, specifically in the `get_imports()` function within `dynamic_module_utils.py`. This vulnerability affects versions 4.49.0 and is fixed in version 4.51.0. The issue arises from a regular expression pattern `\s*try\s*:.*?except.*?:` used to filter out try/except blocks from Python code, which can be exploited to cause excessive CPU consumption through crafted input strings due to catastrophic backtracking. This vulnerability can lead to remote code loading disruption, resource exhaustion in model serving, supply chain attack vectors, and development pipeline disruption.
Tipo di vulnerabilità
CWE-1333
Espressione regolare inefficiente (ReDoS)
Il prodotto usa un’espressione regolare che nel caso peggiore ha una complessità di calcolo molto alta, anche esponenziale: un input costruito ad arte può bloccare il servizio.
Impatto sui sistemi
| Ambito | Impatto |
| Disponibilità |
Interruzione del servizio: esaurimento della CPU |
Come si previene
Architettura e progettazione
Use regular expressions that do not support backtracking, e.g. by removing nested quantifiers.
Configurazione del sistema
Set backtracking limits in the configuration of the regular expression implementation, such as PHP's pcre.backtrack_limit. Also consider limits on execution time for the process.
Sviluppo
Do not use regular expressions with untrusted input. If regular expressions must be used, avoid using backtracking in the expression.
Sviluppo
Limit the length of the input that the regular expression will process.
Tutte le 533 CVE di tipo CWE-1333, con andamento e prevenzione