-
-
Notifications
You must be signed in to change notification settings - Fork 668
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
clarification needed for 12.4.1 #1087
Comments
I agree this needs work. Again, I like to delete confusing requirements. We do not need to be a complete standard, we need to be a clear one, is my opinion. |
Perhaps inserting an explanatory note would resolve the confusion @jmanico or something like the format below:
|
This is really old-school thinking. The situation is way more complex, I again suggest we just delete this requirement and move on. |
Take it as a placeholder, I'll come back to this one when looking entire V12.* |
I'd still like to delete it. |
proposal, delete as duplicate of 4.1.3: |
I agree with your proposal. |
12.4.1 is removed as duplicate of 4.1.3 (just one special case of authorization problems) For fixing "decision time situation":
|
removed 12.4.1 as duplicate of 4.1.3, closes #1087
I am reopening this as I really don't agree that it is a duplicate of 4.1.3 and I don't think it should have been deleted. This is the history of the requirement:
Basically it comes from a 3.0 requirement and I agree that the permissions/validation part is weird and that the webroot part is a little 90s but I still think the "web root" part is important and I don't want it to get lost. I would propose the following, (note the updated CWE):
|
Well, not that easy.
Authorization12.4 is file storage category and was removed from that perspective. From file execution perspective, it should be 12.3 requirement. Client-Side executionWhat about public content - like images, profile pictures, logos, some pdf files etc? We have it kind of covered with othe requirement.
I have made proposal to merge them: #1406 It would be wasting resources to serve static images via program code and may actually cause good DoS vectors. But those are more client-side oriented. Server-Side executionNow the question to solve is - why it may happen, that users can upload as "public content" something, which is executed on the server side via HTTP request as program code. I would call it business logic problem.
See also opened related issues: #1604 We also have another requirement to play with.
What we clearly don't have is (in whatever wording): Verify that files obtained from untrusted sources are not executed as program code when directly accessed with HTTP request. |
Ok, I am going to chalk this up for the rework of 12 |
Can we close this out for now and move these issues to a new issue if needed? |
The problem with the image library (which has dozens of historical examples) should be handled in requirement to keep components updated.
image itself is being executed as program code, e. g. so called polyglots (we have requirement 14.3.6 to limit the file extensions being allowed)
The whole point of file permission limitations is that this class of attack allowed even files with .gif extensions (or in the distant past wmf files and other file types), and with magic bytes claiming to be gif to still be executable ik certain cases. This is why you want to set the file permissions of uploaded files that you publically deploy to be read only. It’s a very basic and easy to implement control that fully shuts this category of attacks down.
Gifs, ICO, SVG and others have had this problem.
Or let me ask another question. Would you want an uploaded file of any type that you stage up in a public directory to be permissioned as executable? This seems like a very bad idea to me.
|
What and why is going to execute it? |
Why? Why do attackers attack? I don’t understand the question.
There is a *lot* of research on uploaded images being executable historically. For a wide variety of reasons depending on the web server type, the app server type, and the image type.
So are you suggesting that staging up uploaded files in a public directory with file permissions being set to executable to be an acceptable practice? Really?
|
Kind of "here we go again" with demagogy. If you allow user to upload (edit: a php) file to public folder that is executed when directly accessed with an HTTP request, it does not require to have "executable" permissions. Read-only is enough. And if it comes to "executable", then something - some process must execute it. This was my question, what process and why it can execute the file? |
> Kind of "here we go again" with demagogy.
This is very insulting when I am in good faith trying for to help. Please stick to the technical conversation. Personal attacks help no one.
And if it comes to "executable", then something - some process must execute it. This was my question, what process and why it can execute the file?
Since its in a public directly any user can navigate to that file. JS files can impact node servers. Gif-Jar’s impact Java servers. There are numberous situations again depending on the server type.
Setting piblically available uploaded files to be read only (depending on the server and other factors) shuts down:
- Remote Code Execution (RCE)
- Web shell attacks
- File inclusion vulnerabilities (LFI/RFI)
- Privilege escalation
- Denial of Service (DoS) through malicious scripts
- Soe forms of Cross-site scripting (XSS) and other injection-based attacks
And even if other ASVS items (like file validation) address these issues, setting uploaded publically staged files to read only - is a fairly standard secure coding practice.
|
For the mirror.
Sorry, but I would say that you don't know what you are talking about. For example, LFI only requires reading permission. |
Sorry, but I would say that you don't know what you are talking about. For example, LFI only requires reading permission.
Again with the personal attacks….
I undetand LFI Elar. But read only permissions reduces the overall likelihood of file upload problems in this category. As mentioned above, this is not just about LFI.
|
Let's come back to this one.
Did I say anything towards that? No. It is your attempt to "assign" this to me, and then saying I'm attacking you :) There is no reason to add executable permissions to uploaded files, but only removing executable permissions from files that are stored in public folders, but otherwise being directly handled by the web server (classical php solution), do not solve ANY of your listed problems. So, your proposed solution does not solve the problem (avoid file getting executed) and I think my conclusion out of that is aligned. |
There is no reason to add executable permissions to uploaded files, but only removing executable permissions from files that are stored in public folders, but otherwise being directly handled by the web server (classical php solution), do not solve ANY of your listed problems. So, your proposed solution does not solve the problem (avoid file getting executed) and I think my conclusion out of that is aligned.
So can you think of any situation where read only vs executable for public uploaded files helps reduce the risk of any web based attack or do you think this is just an unreasonable defense to suggest?
I’m not trying to lead you on, I am genuinely asking.
This is a control I’ve been asked by security engineers to implement for 20+ years. I wonder if all this time it was not necessary.
|
I think the answer was already in quoted text:
|
So I feel like this thread got a bit confused. @elarlang suggested above the following requirement (I made a minor wording change):
@jmanico is there anything missing from that from your perspective? |
This works for me.
|
One may argue that it disallows executing client-side javascript, so maybe we limit it to the server-side program code?
|
I like your suggestion even better, @elarlang - nice ending to this. Thank you. |
Great, let's get this PRed in :) @elarlang |
Actually I understood it mainly the other way :) i.e. if the user uploads an HML or SVG file, you want to make sure that this application won't get executed on the client-side (browser). This is a typical vector for client-side JS injection for example when you let users upload images:
|
For this scenario we have those: V50.5 Unintended Content Interpretation
Related issue to merge 50.5.1 and 50.5.2: #1406 |
Current V12.4.1:
"spin-off" issue from #1065 (comment)
I'm not too happy with this requirement. It feels a bit from old-style PHP crappy architecture, where file in public folder leads to RCE.
The main question is, should we just blindly disallow to store files in public folder in general, or make it a bit more flexible.
The text was updated successfully, but these errors were encountered: