Automating permission tests from application access rules
Automating permission tests from application access rules connects a security requirement to the behaviour of a real feature. The relevant controls need to remain effective across custom code, integrations and the production configuration. Understanding automating permission tests from application access rules helps establish which security property the feature needs and where that property is actually enforced.
What does this involve?
Authorisation determines which resources and operations an established identity may use. It must be enforced where protected data is read or changed. User interface restrictions, obscure identifiers and documentation can help usability, but they do not replace the service's own permission decision.
When you are implementing protection measures for an application, one of the most important parts of the process is defining and implementing the application's authorisations. Despite all of the checks and security audits conducted during the creation phase, most of the problems with authorisations occur because features are added/modified in updated releases without determining their effect on the application's authorisations (usually because of cost or time issue reasons).
To deal with this problem, we recommend that developers automate the evaluation of the authorisations and perform a test when a new release is created. This ensures that the team knows if changes to the application will conflict with an authorisation's definition and/or implementation.
Why it matters
Consider a realistic failure: a permission test suite covers administrator success but never attempts access as another record's ordinary owner.
A missing check can expose another account's information or let an ordinary user perform a privileged action. The result should be described by the actual records and operations reached, including whether access crosses a customer or organisational boundary.
Implementation guidance should be applied to a real feature and its deployment. Framework defaults, custom handlers and integrated services all influence whether the intended protection remains effective.
How penetration testers check for it
Trace the relevant feature from its entry point to the data or operation it protects, including custom code and alternate paths.
- Compare users with different roles and ownership relationships.
- Exercise read, change, delete and alternate access paths.
- Test nested resources, background processing and state changes.
- Confirm rejection as well as the legitimate successful journey.
How to fix it
Use the appropriate maintained mechanisms and verify the result in the actual production configuration.
- Formalize the authorisation matrix in a pivot format file, which will allow you to.
- Allow a human to read and update when you need to follow up on the authorisation combinations.
- Set up a hierarchy of the authorisations, which will allow you to easily create different combinations.
- Create a set of integration tests that fully use the authorisation matrix pivot file as an input source, which will allow you to evaluate the different combinations with the following advantages.
- Enforce permission checks at each protected operation.
- Maintain regression cases for unauthorised users and changed permissions.
A successful response alone does not prove unauthorised access. Establish whose resource was affected and what the caller was legitimately entitled to do.
Recheck the changed behaviour against the original failure conditions and the legitimate user journey. Keep enough evidence to show which release and configuration were verified, and include related entry points that depend on the same security decision.
Related issues
- Documenting application roles, permissions and access rules
- Scoping IoT penetration tests by device component and access level
- Implementing business rules that remain safe under hostile input
Read about our methodology or contact pentested.com to discuss secure development and code review.