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.

In AquilaX

AquilaX finding for an OpenAPI file without global security rules, showing the affected file
This OpenAPI file does not define global security rules. The IaC scanner found this problem.

Screenshots that show scan results use our public test apps, which are vulnerable on purpose. Select an image to enlarge it.

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 BOLAExpressCritical
Vulnerable · routes/orders.js
router.get("/api/orders/:id", requireAuth, async (req, res) => {
  const order = await Order.findById(req.params.id);
  res.json(order);
});
Why it's exploitable

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.

The fix
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
Vulnerable · routes/me.js
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);
});
Why it's exploitable

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.

The fix
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:2023ExpressHigh
Vulnerable · routes/otp.js
router.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) });
});
Why it's exploitable

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.

The fix
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.

See all scanners How to fix findings

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