Putting OWASP ASVS into practice
Applying the OWASP ASVS standard to an existing project, seen through the eyes of a backend developer.
The Application Security Verification Standard (ASVS), created by the OWASP foundation, is a set of requirements for building and maintaining secure applications. In this post, I’ll share what I learned while applying the standard to an existing project as a backend developer.
ASVS logo: source
Introduction to ASVS
ASVS is an extensive framework for verifying how secure an application is. You can use it as a high-level guide for pen-testing, as a secure coding checklist focused on what the application contains, or as guidance for security architecture. Following ASVS helps you spot and reduce security risks and make sure your application lives up to industry best practices.
ASVS is split into 14 chapters covering areas such as Authentication, Access Control, Data Protection, API Security, Configuration Hardening, Threat Modeling, and more, and it defines 286 specific requirements/controls altogether. They can be referenced and organized using the <version>-<chapter>.<section>.<requirement> format.
ASVS also defines three verification levels:
- Level 1: Addresses vulnerabilities that are easy to find – the absolute minimum. It can be fully verified with penetration testing, with no access to the source code.
- Level 2: Protects against the majority of risks present in today’s software. Recommended for most applications.
- Level 3: Intended for applications that need a high level of security, usually handling data in sectors like finance, medical, and military.

The verification levels of ASVS
The most recent stable version of ASVS is v4.0.3, published in 2021. Work on the next major version is well underway, and according to the Roadmap to version 5.0 from late 2024, ASVS 5.0 is in its final countdown.
Example of the ASVS requirement
Let’s take ASVS requirement v4.0.3-3.2.1 from Chapter 3: Session Management as an example:
Requirement v4.0.3-3.2.1, source: OWASP ASVS
It stresses that a new session token must be generated when a user authenticates, which is an essential control against session fixation attacks. As we can see, it applies to every ASVS level (L1, L2, L3).
Each requirement is made up of a 1-3 sentence description and the ID of a particular Common Weakness Enumeration (CWE) entry – a catalog of common software and hardware security weaknesses maintained by the MITRE Corporation.
Some requirements also link to a specific chapter of the OWASP Top 10 Proactive Controls – in our example: C6: Implement Digital Identity.
Chapter 2: Authentication and Chapter 3 are additionally mapped to NIST 800-63b – an authentication standard from a U.S. government agency.
Implementing ASVS level 2
Not long ago, my team and I were tasked with implementing ASVS at level 2 – it had been mandated from above as the organization’s standard. To be clear, OWASP doesn’t offer any official “certification” for reaching an ASVS level. Verification was to be done through penetration testing and an audit by the internal security team, based on a self-assessment sheet with acceptable comments confirming each requirement. On top of that, ASVS compliance would be checked every year to make sure the system stays in line with the standard over time.
The project I was working on was a microservice-based system running on Kubernetes in the Azure public cloud. It provided a few UIs built with React. The backend was written in Scala, so it runs on the JVM and relies on Scala/Java libraries.
The project is roughly 3 years old, so it can be called mature, and it was generally built with application security in mind.
ASVS v4.0.3level 2 includes 267 requirements. Having gone through them one by one, we found that:
- Over half of the requirements were easy to identify and already satisfied.
- 80 requirements turned out to be not applicable to our case.
- Some requirements needed more thorough research before we could confirm compliance.
- A portion of the requirements was not passed and called for fixes or improvements.
This showed that even when many controls are already in place, achieving the full targeted ASVS level usually takes a careful review, in-depth research, and focused fixes.
Insights from implementation
ASVS level 2 is made up of a wide range of requirements – out of all 267, some are simple, while others are harder. Below are some specific ASVS v4.0.3 requirements from various areas, grouped into categories, that I find worth a closer look.
Easy Requirements
1.11.1 Verify that all application components are defined and documented in terms of the business or security functions they deliver. L2, L3 - CWE 1059
- This was the simplest requirement to confirm, since we have kept our system documentation current right from the start.
5.5.2 Verify that the application properly limits XML parsers to the most restrictive configuration possible and that unsafe features, such as resolving external entities, are turned off to prevent XXE. L1, L2, L3 - CWE 611
- XML eXternal Entity injection (XXE) was ranked number 4 in the OWASP Top Ten in 2017.
- To protect against an XXE attack, we follow the relevant recommendations of the OWASP Cheat Sheet on XML Entity Prevention – fully disabling DTDs (Document Type Definition) & External Entities.
val xmlInputFactory = XMLInputFactory.newFactory()
xmlInputFactory.setProperty(
XMLInputFactory.IS_SUPPORTING_EXTERNAL_ENTITIES, false)
xmlInputFactory.setProperty(
XMLInputFactory.SUPPORT_DTD, false)
Non-Applicable Requirements
2.1.1 - 2.1.12 The entire section on password security. L1
- The section deals with best practices for password security, concentrating on strong yet user-friendly policies such as long passwords, allowing pasting, and checking against breached passwords.
- Login and password settings are handled by Azure Entra ID – it can be configured correctly to meet security standards. You can also look at Entra’s recommended best practices to raise your level of security.
- In our particular case, these requirements can be considered non-applicable, as Entra ID is outside our control – it’s managed by a different internal team, which also has to pass the ASVS check.
2.5.1 Verify that an initial activation or recovery secret generated by the system is not sent to the user in clear text. L1, L2, L3 - CWE 640
- As the system is internal (it requires an email address in the company domain), there’s no standard registration. Recovery is handled by Entra ID, which in our case is managed by a different internal team.
Engaging Requirements
1.2.1 Verify that unique or special low-privilege operating system accounts are used for all application components, services, and servers. L2, L3 - CWE 250
- This requirement helped us find several docker images that had to be moved from root-based accounts to low-privilege accounts, so that every service runs with minimal permissions – running containers as a non-root user limits the possible damage of a security breach.
- This could have been done properly right from the start of each docker file.
- To find out more about the risks of running containers as root, take a look at Container is running in privileged mode on Snyk Academy.
1.14.4 Verify that the build pipeline includes a step that automatically builds and verifies the secure deployment of the application, especially when the application infrastructure is software defined, for example cloud environment build scripts. L2, L3 - CWE 923
- Automating secure deployment can be tricky, because it means integrating several tools, balancing speed against security, and dealing with false positives.
- We satisfy this requirement with:
- Secret Scanning and Code Linting – during the pre-commit phase
- Fortify & SonarQube – for in-pipeline SAST (static application security testing) – a weekly scan
- Qualys – for in-pipeline DAST (dynamic application security testing) – a monthly scan
- Snyk – for in-pipeline SCA (software composition analysis) – a weekly scan
14.4.3 Verify that a Content Security Policy (CSP) response header is present to help reduce the impact of XSS attacks such as HTML, DOM, JSON, and JavaScript injection vulnerabilities. L1, L2, L3 - CWE 1021
- Setting up CSP took a lot of configuration, testing, and coordination with external services to get the strongest possible protection against XSS without breaking the application.
- Using the Kubernetes ingress controller – in particular Project Contour, which runs Envoy under the hood – lets us manage incoming traffic and rewrite response headers with the right CSP configuration. This approach keeps things centralized and consistent across every service.
- Adding CSP late in development may not have been the hardest part – the OWASP Content Security Policy Cheat Sheet helped a lot – but, once more, it could have been done more efficiently right from the project’s start.
Interesting Requirements
6.3.2 Verify that random GUIDs are generated with the GUID v4 algorithm and a cryptographically-secure pseudo-random number generator (CSPRNG). GUIDs generated with other pseudo-random number generators can be predictable. L2, L3 - CWE 338
- This caught my attention because it shows how much the quality of randomness matters, even for GUIDs
- Standard pseudo-random number generators (such as
java.util.random()) aren’t cryptographically secure, but some SAST scans would flag them; still, I can picture developers accidentally using GUID versions older than v4. - We meet this requirement by using
java.util.UUID.randomUUID()in the backend and therandom_passwordresource in Terraform, both of which are cryptographically secure.
8.3.7 Verify that sensitive or private information that must be encrypted is encrypted with approved algorithms that ensure both confidentiality and integrity. L2, L3 - CWE 327
- Put simply, we use an encryption process to protect data sent between services. Some sensitive data has to be hidden from services that aren’t entitled to it. The originating service, which talks to many other services, encrypts the data with a custom Encryption Service that provides encryption-at-rest. Only precisely specified receiving services decrypt the data securely when they need it.
- We rely on the AES/ECB/PKCS5Padding encryption algorithm. ECB mode (electronic code book) is the most basic encryption mode and is usually discouraged – it would certainly catch the eye of any auditor.
- Still, for our use-case this approach is acceptable because of details of the internal architecture (briefly: a unique secret key is generated for each value, and each value is at most 128 bit (1 block) in size).
- This example shows how security requirements can be met through well-considered design decisions, even when, for instance, using encryption modes that normally raise red flags.
13.2.2 Verify that JSON schema validation is set up and performed before input is accepted. L1 - CWE 20
- We parse and validate JSON request entities with Circe, a JSON library for Scala.
- However, although Circe validates against Scala case class structures, this happens during parsing and may not fully satisfy the requirement of validating input before acceptance as described in the formal JSON Schema standard.
- Interestingly – (according to this ASVS github discussion) – the next major ASVS version moves this requirement from L1 to the L3 verification level, so we chose to leave it as it is.
Summary
OWASP ASVS is a hands-on framework for raising application security, offering clear requirements in the form of a structured secure coding checklist.
Another thing I appreciate is that you can adopt just selected parts of ASVS when needed. For instance, when you add a new API, you can concentrate on the API Security chapter to make sure the endpoints are secure. Likewise, when you introduce a new authentication module, you can use the Authentication chapter to enforce secure login practices. ASVS is flexible and lets you improve security step by step as your system grows.
I hope the examples in this post make it clear how ASVS can be approached and implemented, for example in existing projects – through a careful review of the requirements, well-considered design decisions, and building security practices into your workflow.
If you need developers who build systems according to the highest standards of the Secure Software Development Lifecycle (SSDLC), get in touch with us – we use the best tools and practices, including our technological partnership with Snyk, to keep your software secure.
On top of that, take a look at our free eBook: Cybersecurity: developing a security-first mindset, which offers useful insights into building secure applications.