-
-
Notifications
You must be signed in to change notification settings - Fork 673
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
Consideration for Memcache Injection Vulnerabilities #1791
Comments
How the proposal is different from current 8.1.1?
edit: but if I watch your code example, then there the problem is not caching as such, but not validated/sanitized value for In general I smell the usual "testing checklist" vs "list of requirements for reporting" mindset difference here. |
These two are completely different!!! Memcache Injection represents a specific attack vector that arises from the unique way Memcache interprets concatenated commands. This risk is distinct from merely caching sensitive data. |
Well, there is a bit difference in your proposal as well:
May comment was for this proposal - this proposed text is quite similar to 8.1.1 requirement - the end goal is the same. Now when I watched your code example, it was a bit different problem there than proposed requirement. |
I would like to highlight some key distinctions that make the inclusion of specific guidelines for Memcache Injection distinct from what is currently covered in 8.1.1. Firstly, requirement 8.1.1 primarily addresses the prevention of sensitive data being cached in server components and ensuring secure purging of data post-use. While important, this requirement doesn't explicitly cover the validation and sanitization of data being used in cache operations, especially in the context of Memcache. The core of Memcache Injection attacks lies in the manipulation of cache keys or values, which is not directly addressed in 8.1.1. The proposed requirement emphasizes the need for specific handling of data sent to Memcache servers, focusing on validating and sanitizing the data used in Memcache commands to prevent attackers from executing malicious operations. I encourage you to review the nature of Memcache Injection attacks. |
I was going to write the answer, but... everything I started to write is already written. Sometimes I wonder do people read before they post comments... :) For (re)starting point:
|
I think 5.3.4 is more applicable to memcache injection:
There are many requirements already to prevent against specific types of attacks:
You could say, "memcache injection is missing from this list!", and you would be right. But I think it is pointless to try to exhaustively list all systems which would be vulnerable to injection. I would rather see more general requirements that work against all forms of injection.
This shouldn't be vulnerable to injection. The The blog post also suggests using prepared statements, but memcache doesn't have those. It also seems to confuse memcache and memcached. |
@Sjord I understand your point about the potential confusion between 'memcache' and 'memcached.' To clarify: Memcached is the specific open-source distributed memory caching system. It's the actual software that runs as a daemon and provides the caching functionality. Memcache, on the other hand, is often used more generally to refer to the concept or methodology of caching objects in memory to speed up applications. Additionally, in some programming languages, like PHP, there are libraries named 'Memcache' used to interface with the Memcached service. Regarding with the Let's go for a real world example for Memcache Injection, to simplify this, a user's routing information is stored like this:
An attacker finds a way to inject a newline character and additional command. Now, the cache has an entry that not only stores the attacker's route, but also executes the malicious command which changes the route for the user to an attacker-controlled server. I'm curious to understand the reasoning behind the viewpoint that including Memcache Injection in the ASVS would be pointless. Could you elaborate on how we distinguish between vulnerabilities like LDAP or IMAP Injection, which are deemed valid for inclusion, and Memcache Injection, which is considered not necessary to include? |
If we separately include things like LDAP injection and IMAP injection, I agree that we can't really ignore memcache injection. I do however think it is highly likely that at some point we will need to compress these requirements into less requirements. In the meantime, is there any sanitization required other than preventing newlines @ImanSharaf? |
I think the best solution for memcache and other forms of injections is to use a library with an API that automatically encodes/escapes/validates. The application does not have to take care of injection anymore, since this is abstracted away by the library. PHP's memcache APIs already do this, so
is not vulnerable. The problem occurs if the application talks to memcache directly and creates its own commands by concatenating strings. I think "use a high-level API instead of talking to the other system directly" can be a nice requirement, solving many security problems. |
From the requirement point of view, it applies to the last bit which communicates with an external component (in this case Memcache). |
Thoughts on:
|
I don't like the direction, I think we should concentrate only on preventing security holes from happening not giving architecture (and not directly security-related) advice. |
Having discussed with @elarlang, I think we don't need to be too prescriptive...
Any final thoughts? |
It works for me. |
The situation at the moment:
|
Opened #1856 to add this |
Memcache, a widely-used distributed memory caching system, can be vulnerable to injection attacks. These vulnerabilities arise when untrusted data is concatenated into a Memcache command without proper handling or sanitization. The impact of such vulnerabilities can range from data leakage to unauthorized access or modification of cached data. Reference:
Proposed requirement:
The text was updated successfully, but these errors were encountered: