Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

vendor package issues #6619

Open
eywa-saravanan opened this issue Nov 20, 2024 · 2 comments
Open

vendor package issues #6619

eywa-saravanan opened this issue Nov 20, 2024 · 2 comments
Labels

Comments

@eywa-saravanan
Copy link

Hi,

we face security issue.. need for solution..

issue detail given below

package name : Doctrine DBAL

Package link : https://github.com/doctrine/dbal

issue description :

line numbers :
a) vendor/doctrine/dbal/src/Cache/QueryCacheProfile.php:130

  1. An attacker can exploit the weaknesses of SHA-1 to perform collision attacks, potentially leading to data breaches and loss of data integrity.

solution need like this : It is recommended to avoid using SHA-1 for hashing. Instead, opt for stronger hashing algorithms such as SHA-256 to enhance security.

thanks

@derrabus
Copy link
Member

Can you elaborate how a collision on a cache key is a possible security threat?

@morozov
Copy link
Member

morozov commented Dec 22, 2024

In theory, two queries may produce the same hash (regardless of the hashing algorithm) and thus, the caller of one query may get access to the results produced by another.

From the security-related static analysis standpoint, a proper fix would be eliminate hashing of the query in the cash and use the full query and parameters as the key.

For instance, in the case of array-backed cash, PHP internally will hash the key but it will also compare the values during array access to avoid collisions. As for all other backends, there may be natural limitations to their key lengths, so again, a theoretically correct solution would be to implement a hash table that would map the queries and their parameters to the external cache key but also would properly handle hash collisions.

At this point, it doesn't look like a practical problem, so I don't think we need to make any changes in the library.

@morozov morozov added the Cache label Dec 22, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

3 participants