Can the deletion and status switching interfaces on the back-end be accessed directly through the browser to trigger?
If the interface for deleting a piece of data or switching a status in the background is allowed to be accessed directly through the address, the risk does not lie in the literal meaning of 'interface exposure', but inAny click with a login status can become an execution. This version fix of the peer open source program is exactly this: The background user delete and status switch interface can be triggered by a bare GET request to carry out cross-site request forgery. The repair method is to change it to POST submission and verify the form identifier. This kind of repair is worth every website builder to check self once.
What kind of interface will be triggered directly by the browser
Interfaces that meet two conditions are in this category: first, it can be accessed through the address bar, which means there is no distinction between request methods; second, it will change the data, such as deleting, enabling and disabling, approving, and moving to the recycle bin.
A dangerous combination appears here: The administrator logs in without logging out, and the login state remains in the browser; at this time, he opens an article sent by someone else, an image address, or an automatic request embedded in the page. The request arrives at the back-end with his identity, and the server sees that a 'logged-in administrator is performing a delete', unable to tell that this is not something he initiated himself.
Why is the login state itself dangerous enough
The backend authentication usually relies on session credentials: after a successful login, a credential is issued, and all subsequent requests carry it. In the implementation of JWT and other signed token technologies, the credential itself does not need to be checked again for the password, as long as the signature matches. This brings a feature ofWhether the credential has been borrowed cannot be seen from the authentication step.
Therefore, the real defense line cannot only be placed on 'whether there is a login', but also on 'whether this action is initiated by the user on this page'.
What do request methods and one-time verification block
The two things solve two problems:
| Closing methods | The scenarios blocked | The scenarios that cannot be blocked | Judgment basis |
|---|---|---|---|
| The action to change the state only accepts submission methods, not direct access | Automatic requests and placeholder image requests inserted into the page | The attacker诱导诱导users to actively submit forms | Whether the interface distinguishes methods |
| Verification of one-time form identifiers | Cross-site initiated write operations | Advanced construction after obtaining the page content | Whether the verification value is bound to the session, whether it can only be used once |
| Credentials set with a short validity period | Login state is borrowed for a long time | Abuse within the validity period | Expiration time and refresh strategy |
| High-risk interfaces are closed by domain | The capability not needed is called externally | Misuse of the enabled capability | Default whether to open |
Using **item alone will be bypassed, and using the second item alone will also be the same; both items must be used together for the 'modify data' action to require a value that an attacker cannot obtain from their own page.
How to close the mouth at these two places on our back-end
The security capabilities within the station are configured in layers: authentication uses signed tokens, the interface layer converges exposure range according to intent directory, operations such as backup, upgrade, and multi-site are default closed at the station level, and need to be explicitly enabled to be callable externally. Write operations also support round-level merge confirmation, and a list of changes to be made in a batch operation must be provided first, and confirmed before it is implemented.
Version level also has a counterpart. v3.6.6 fixed two issues, one is the injection caused by the list sorting parameters being spliced into the query statement, and the other is that the login credentials used for site switching can be forged. The former belongs to 'parameters went into the query', and the latter belongs to 'the validity period and usage of the credentials are set too broadly'. These two and cross-site request forgery are actually three aspects of the same type of problem:Do not leave anything that can be borrowed to be guessed by the outside.
Self-check three steps: list, method, verification
Step **, pull a list of all actions that modify data in the background, and divide them into three groups: 'delete class', 'status class', and 'import class'. Step two, confirm whether each action can be triggered directly through access; any action that can be triggered must be changed. Step three, confirm whether each action carries a session-bound validation value, and whether this value is used and then discarded.
Add an operation and maintenance specification: after the repair, the signature key should be rotated and the administrator's password should be changed, because the solution to the narrowing of the attack surface is for the future, while the solution to whether the credentials have been leaked is for the present.
Common questions
Question: Is it okay to just change the background address to an unpredictable path?Answer: Not enough. Address obfuscation does not change the fact that 'requests with login state will be executed', and writing the backend path into public files like robots.txt反而exposes the entry point.
Question: Is there a risk if the interface only does queries?Answer: The nature of the risk is different. The query interface needs to prevent unauthorized reading and injection, and the modification of data needs to prevent it from being borrowed to initiate, the two need to be checked separately.
Question: Can throttling and captcha replace these two?Answer: No. They reduce the efficiency of batch attempts, but a successful forgery does not need to be tried multiple times.