disable showerrors by default#2513
Conversation
|
We have to think about this a little bit, because some errors are meant to be shown (like SAML2 errors). |
|
Fair enough if there's some nuance and it's desirable sometimes for a meaningful error message to be shown to users. However in the case of the XXE vulnerability the display of verbose error messages can definitely be abused - happy to share more details if that would help. Would it make sense to implement something like an additional The default could then be to show only very minimal error messages / those that would useful to an end user, but retain the ability to increase the verbosity e.g. for debugging during set up. |
If this whitelist is not used then all errors are shown if showerrors is true. If you use this new option then you have to list every error you would like to be shown to the user with a description and backtrace. This was raised in simplesamlphp#2513
|
A possible solution is #2521 In 2521 you can select explicitly which errors to show the description/backtrace for and if the error is not selected it doesn't get the backtrace. I made the array allow picking explicitly so you can do the following to show no errors. A bit counter productive though since you could just not use the option and set |
|
Focusing on 2.4. I am tinkering with my config.php but it seems that debug traces are shown for me in the browser when using the default values. Sorry if I have something set in config.php that does this but I can't see what that might be when looking over a diff to In error.twig it is using The |
|
Given that, we have already had the 'backtraces' option for the debug setting. We can respect that setting with the error setting to surface the detailed debug information in the error page if desired. The proposed changes are:
In a user case where the user does want to have the stack trace details in the logs, but does not want those information expose to the client side (a browser). The configuration should be set as: which aligns with the current behaviour. Proposed PR: #2540 |
|
Since this was the original PR to raise the issue and there seems consensus that setting showerrors to If showerrors is true in general then there is a potential to leak information to expressly nefarious users. I will follow up discussion as to if the default is modified in the 2.5 series and/or how this might be communicated to administrators in general who have not changed the default setting. |
|
@mcdruid thank you for the detailed PR. |
If this whitelist is not used then all errors are shown if showerrors is true. You can use this new option to explicitly allow backtraces and descriptions to be shown to the user for only select error events. If you provide a list of errors to show then anything not on that list will not be shown to the user. The error will be logged etc as normal. This was raised in simplesamlphp#2513
If this whitelist is not used then all errors are shown if showerrors is true. You can use this new option to explicitly allow backtraces and descriptions to be shown to the user for only select error events. If you provide a list of errors to show then anything not on that list will not be shown to the user. The error will be logged etc as normal. This was raised in #2513
SimpleSAMLphp has
showerrorsenabled by default.Although this is no doubt convenient at times, it's risky from a security point of view. See, for example:
https://owasp.org/www-community/Improper_Error_Handling
A specific example of this in SimpleSAMLphp was CVE-2024-52596 whereby an attacker could induce a specific error condition via XXE that causes the application to reveal potentially sensitive information within an error message.
showerrorsshould be disabled by default to avoid such problems.Filing this as a public PR as all of the details are public already; there is no novel information about an exploitable vulnerability here.