API security scanning
API security scanning checks OpenAPI files for access-control and encryption problems. It does not send requests to your API.
Included in Premium and Ultimate.
What it looks for
Access control
Operations without the expected access rules.
Encryption
API settings that allow connections without encryption.
Security-focused results
Style and completeness rules are not included.
Examples
These examples show common problems and safer ways to write the code. They are not AquilaX results, and scanner coverage can vary.
Logged in, but not checked for ownership
API1:2023 BOLAExpressCriticalrouter.get("/api/orders/:id", requireAuth, async (req, res) => {
const order = await Order.findById(req.params.id);
res.json(order);
});
The route checks that you're logged in, not that the order is yours. Change the ID and you get someone else's order. If IDs are sequential, a loop downloads every order in the system.
BOLA tops the OWASP API list because it's easy to write and hard to spot in review.
const order = await Order.findOne({
_id: req.params.id,
userId: req.user.id,
});
if (!order) return res.sendStatus(404);
res.json(order);
Mass assignment through Object.assign
API3:2023ExpressHigh
router.patch("/api/me", requireAuth, async (req, res) => {
const user = await User.findById(req.user.id);
Object.assign(user, req.body);
await user.save();
res.json(user);
});
The form only sends name and avatar, but the API takes any field. {"role":"admin","plan":"enterprise"} and the user has promoted themselves.
The response also returns the whole user record, passwordHash included.
const { name, avatar } = req.body; // allowlist
Object.assign(user, { name, avatar });
await user.save();
res.json({ id: user.id, name: user.name, avatar: user.avatar });
An OTP endpoint with no attempt limit
API4:2023ExpressHighrouter.post("/api/verify-otp", async (req, res) => {
const ok = await otp.check(req.body.phone, req.body.code);
if (!ok) return res.status(401).json({ error: "invalid code" });
res.json({ token: issueToken(req.body.phone) });
});
A 6-digit code has a million possible values. Around 1,700 requests a second covers all of them before a 10-minute code expires, which a handful of machines can do easily.
const limiter = rateLimit({ windowMs: 15 * 60_000, max: 5,
keyGenerator: (req) => req.body.phone });
router.post("/api/verify-otp", limiter, async (req, res) => {
// and burn the code after 5 wrong attempts
What to know
- Keep your OpenAPI file up to date. The scanner cannot find an endpoint that is missing from the file.
- Use DAST on Ultimate to test a running API. DAST can use your OpenAPI file.
- Some problems need a manual test, such as one user being able to see another user's data.
Questions and answers
What is the difference between API scanning and DAST?
API scanning checks an OpenAPI file. DAST sends requests to a running app or API.
Can this scanner find every OWASP API Top 10 problem?
No. Many of those problems only appear when the API is running. Use DAST and manual testing as well.
What do I need for API scanning?
You need an OpenAPI file that describes your API. Keep it up to date, because the scanner cannot check endpoints that are missing from it.
Does this scanner send requests to my API?
No. It only checks the OpenAPI file. To send test requests to a running API, use DAST on Ultimate.
Can DAST use my OpenAPI file?
Yes. Add the address of the file or paste its contents into your security policy. If AquilaX cannot load the file from its address, the rest of the scan still runs. A finding explains that the API part was skipped.
Does API scanning check OpenAPI style rules?
No. It does not report style or completeness problems. It focuses on access control and encryption.
Why are some OpenAPI findings labelled IaC?
The IaC scanner can also report some OpenAPI security problems. Check the results from both scanners.
Which plan includes this scanner?
Included in Premium and Ultimate. Compare plans.
Try it on one of your repositories
Create a free account and run a scan. If you need Ultimate, self-hosting or a larger rollout, talk to our team.
No credit card needed. Read the documentation