AI pentesting guides / By tech stack

Stack guide: Strapi

Strapi security testing

Strapi security testing starts with the Users and Permissions plugin: every content type gets REST and GraphQL endpoints, and whether find, findOne, create or update are open is controlled by the Public and Authenticated role settings in the admin panel, which are easy to tick too generously.

Strapi is also a full Node application with an admin panel, plugins and upload handling, so it carries ordinary web risks plus a CVE history worth checking against your version.

Role permissions and data exposure

  • find and findOne enabled for the Public role on content types that hold drafts, internal notes or customer submissions.
  • populate=* or deep populate parameters pulling relations, including the user relation, into responses.
  • Filters on fields that should be private can let a caller infer values one character at a time even if the field is not returned.
  • The Authenticated role granted update on a collection without an ownership policy, so any user can edit any entry.

Users and registration

The /api/auth/local/register endpoint should only accept the fields you expect. Test whether extra fields such as role, confirmed or blocked are accepted. Check password reset and email confirmation flows for host or URL injection, and confirm that /api/users and /api/users/:id are not readable by the Public role, since they expose email addresses.

Admin panel and known vulnerabilities

  • /admin exposed to the internet invites credential stuffing; restrict by network or SSO where possible.
  • CVE-2023-22621: Strapi through 4.5.5 allowed authenticated server-side template injection in email templates leading to code execution; fixed in 4.5.6.
  • Upload plugin settings that allow SVG or HTML can lead to stored XSS when files are served from the main domain.
  • Outdated community plugins carry their own vulnerabilities.

API tokens and deployment settings

Strapi's API tokens come in read-only, full-access and custom types. A full-access token embedded in a frontend or static-site build gives anyone write access to all content. Also check that the GraphQL playground is disabled in production, that CORS is limited to your sites, and that the upload provider does not serve private files from a public bucket.

With Pentest-Swarm

Testing Strapi with Pentest-Swarm

Pentest-Swarm tests the Strapi instance over HTTP, the way a frontend or an attacker would use it.

  • Run api-security against the /api base path to check each content type as anonymous and as an authenticated test user (token via --auth).
  • If the GraphQL plugin is enabled, run graphql-audit against /graphql too.
  • Mass-assignment tests add role and status fields to registration and update requests.
  • nuclei templates provide broad known-CVE checks against the detected Strapi version.

Where it falls short

A black-box test cannot see role settings in the admin panel, so it reports what is reachable rather than what is configured. Review the Users and Permissions matrix after every new content type, and keep Strapi itself patched; template-injection issues like the one above are fixed by upgrading.

Questions

Why is my Strapi content visible without logging in?

Because the Public role has find or findOne enabled for that content type. Remove those permissions or add a policy.

Is populate=* dangerous?

It can return related records, including users, that the caller should not see. Restrict which relations can be populated, or sanitise output.

Should the Strapi admin panel be public?

Ideally not. Serve it on an internal network or behind an identity-aware proxy, and enforce strong passwords and MFA.

Sources

  1. NVD: CVE-2023-22621