Study guide · Secure Development

Secure development with TYPO3: Input, attacks and access

As of November 15, 2026 · TYPO3 14.3 LTS · about 18 min read

Security comes from habits, not from a single tool. This page answers three questions: How do you handle outside data? Which attacks exist, and what helps? And who may do what?

Every input is suspicious

Our example is the conference extension my_extension. It has a registration form, a talk search, speaker biographies, a slide download and an import from a foreign REST API.

Here, data comes in from outside. The rule is: every input is suspicious.

  • Visitors choose GET parameters and POST data freely.
  • They change hidden form fields in the browser's developer tools.
  • Cookies and HTTP headers such as User-Agent or Referer can be forged.
  • You treat responses from external APIs the same way, because a foreign system can be compromised too.

Only constants in your own code are not input. HTTPS only protects the transport.

Reading input: In TYPO3 you read data through the PSR-7 request object, not through superglobals, which also makes the code testable. In Extbase the values arrive as action parameters.

$term = $request->getQueryParams()['term'] ?? '';
$data = $request->getParsedBody();
Code example. getQueryParams returns the URL parameters, getParsedBody returns the POST data.

Checking in the browser is not enough. The HTML attribute required and JavaScript are only a convenience. An attacker sends the request directly with curl. The binding check happens on the server.

Validating and sanitizing

  • Validation checks whether input matches the expected format and rules. If not, it rejects the input.
  • Sanitizing changes the input until it is harmless for a specific purpose.

Allowlist instead of denylist: If a sort parameter may only be title or date, compare it with exactly this list. A list of forbidden characters always misses a trick.

Numbers: An int cast reads the leading digits. The text “5 OR 1=1” becomes the number 5, and the SQL part is dropped. A text without a leading digit becomes 0, and there is no TypeError. If a number must lie within a range, validate it instead.

$count = filter_var($params['count'] ?? null, FILTER_VALIDATE_INT,
    ['options' => ['min_range' => 1, 'max_range' => 100]]);
if ($count === false) {
    return new JsonResponse(['error' => 'invalid count'], 400);
}
Code example. filter_var checks whether count is an integer between 1 and 100. Otherwise the endpoint responds with status 400.

The function is_numeric() is too generous, it also accepts 1e5 or 2.5.

Validation in TYPO3: In Extbase you attach validators to properties and arguments with the attribute Validate. The Form Framework ships validators such as EmailAddress or StringLength. In the backend the TCA checks values, for example with the type email or with eval. The Core does not validate GET values on its own.

Input from the request Target Treatment SQL query Named parameter createNamedParameter() HTML output Escaping htmlspecialchars() Page ID Cast to an integer (int)$uid File name Allowlist allowed characters, extensions No single function protects every target.
Every target needs its own treatment.

XSS and SQL injection

With cross-site scripting, XSS for short, code gets into the output unfiltered and runs in the browser of other visitors. A speaker puts a script into their biography, and every profile visitor runs it.

The remedy is escaping on output. The function htmlspecialchars() converts angle brackets, the ampersand and quotes into HTML entities. A script tag then appears as plain text. Fluid escapes every variable this way. The ViewHelper f:format.raw switches this off, never use it for user input.

With SQL injection, input is executed as part of an SQL statement. The remedy is prepared statements: query and values stay separate. In the QueryBuilder you pass every value with createNamedParameter(), numbers too.

Each vulnerability has its own countermeasure:

  • Named parameters help against SQL injection.
  • Context-aware escaping on output helps against XSS.
  • Tokens bound to the session help against cross-site request forgery.
  • Neither escaping nor a content security policy helps against code execution or path traversal.

To learn more, read the OWASP Top 10 and the OWASP Cheat Sheets. TYPO3 Explained has Security Guidelines, and typo3.org has security advisories.

Attacks on the server

With arbitrary code execution, an attacker runs their own code on the server and can do anything the web server can. These places are dangerous when input reaches them:

  • The function eval() runs text as PHP.
  • An include or require with a path from the request loads any file.
  • The function unserialize() can create objects with magic methods. In contrast, json_decode() only returns arrays and simple values.
  • The web server may execute uploaded PHP files.

Against such uploads TYPO3 has the fileDenyPattern, a regular expression. If a file name matches, TYPO3 refuses the upload or rename. The default blocks PHP extensions, even with another extension behind them as in bild.php.jpg. The file .htaccess is blocked as well. PDF and SVG are allowed.

Path traversal: The slide download takes a file name from the URL. An attacker leaves the folder with two dots and a slash.

?file=../../config/system/settings.php
A typical attack value. It goes up two folders and tries to read the file settings.php.

This is how you protect yourself:

  • Pass the uid of a FAL file instead of a path and check its access.
  • Check file names against an allowlist or reduce them to the bare name with basename().
  • Resolve paths with realpath() and check that they are inside the allowed folder.

Removing the sequence once with str_replace() is beaten by four dots and two slashes. URL-encoded variants bypass simple filters too. Every operating system is affected, not just Windows.

Information disclosure helps targeted attacks. Examples are stack traces with paths on a live system, a reachable .git directory, backups in the web root and a phpinfo() page.

  1. On the live system, set the setting displayErrors in the SYS section to 0.
  2. Leave devIPmask empty. It names the IP addresses that see debug output. An asterisk shows it to everyone.
  3. In a Composer installation, make only the folder public the document root. Then config, var and vendor with credentials, logs and libraries stay unreachable.

Keep secrets such as an API key in an environment variable or a file outside the Git repository. Whatever was committed stays in the history. In frontend JavaScript, every visitor can read it.

Logs are often less protected than the database. Never log entered passwords, not even partially, and no session IDs or tokens in plain text. User name, time and reason are fine.

Foreign requests and tampered links

With cross-site request forgery, CSRF for short, a foreign website makes the browser of a logged-in user perform an action unintentionally. The browser sends the session cookie automatically. Unlike XSS, the attacker needs no script on your site.

Foreign page hidden form via the browser Browser of the logged-in editor Session cookie: sent automatically Token: missing, unknown to the foreign page TYPO3 checks the token: does it match the session? Yes No executed only from the real page rejected request from outside POST alone, the referer or the user uid do not protect.
The browser sends the cookie by itself, only the real page knows the token.

POST alone does not help, a foreign page can post forms too. The referer can be suppressed, and the user uid is no secret. What helps is a token bound to the session. In the backend, FormProtection creates it.

$formProtection = $this->formProtectionFactory->createFromRequest($request);
$token = $formProtection->generateToken('myext', 'delete');
$valid = $formProtection->validateToken($submittedToken, 'myext', 'delete');
Code example. The FormProtectionFactory creates a protection object from the request. generateToken writes a token into the form, validateToken checks it on submit.

In the frontend, TYPO3 protects forms such as the login with a request token. The RequestTokenMiddleware checks it together with a nonce cookie. These tokens are meant for POST, PUT and PATCH, not for GET.

Extbase forms contain the hidden field __trustedProperties. It lists the allowed fields and is signed with an HMAC. So nobody can inject additional properties. It does not help against CSRF. According to the documentation, it also does not stop a changed identity pointing to another record. Check ownership of the record yourself.

Signed parameters: A download link contains values that visitors must not change. The HashService signs them with the secret key of the installation: appendHmac() appends the signature, validateAndStripHmac() checks it. Base64, on the other hand, secures nothing.

Random tokens, for example for a confirmation link, come from Random::generateRandomHexString() or random_bytes(). Both use a cryptographically secure random source. uniqid() is based on the time, and rand() is not secure.

Open redirect: If an action redirects to an address from the URL after login, attackers can send victims elsewhere. GeneralUtility::sanitizeLocalUrl() only lets relative addresses and addresses of your own installation through. For foreign hosts it returns an empty string. Since TYPO3 14 you pass the request as the second argument. The check FILTER_VALIDATE_URL does not help, it only checks the form.

Who are you, what may you do?

  • Authentication checks who someone is, for example by password. Multi-factor authentication strengthens it. If a valid login is missing, the HTTP status 401 fits.
  • Authorization checks what someone may do, through roles, groups and permissions. If someone is logged in but not allowed, the status 403 fits.

Authorization always follows authentication. An editor who is logged in but must not edit a page is stopped by authorization. A password hash belongs to authentication.

Good practice: Everyone gets only the modules, pages and tables they really need. This is the principle of least privilege. You define permissions in backend user groups, not per user. A shared account is bad, because the log no longer shows who changed what.

Permissions in your own code: A logged-in user is not automatically authorized.

$GLOBALS['BE_USER']->check('tables_modify', 'tx_myext_item');
$context->getPropertyFromAspect('frontend.user', 'isLoggedIn');
Code example. check tests whether the backend user may modify the table tx_myext_item. The context tells whether a frontend user is logged in.

The DataHandler checks table permissions itself, direct code must do it. A visitor can fake a cookie or an argument, but not the context. Since TYPO3 14, Extbase actions also have the attribute Authorize. It requires, for example, a login or certain groups, and otherwise responds with status 403.

The Install Tool can rebuild the whole system without a backend login, so it has two barriers. First, the file ENABLE_INSTALL_TOOL must exist on the server, and TYPO3 deletes it after 60 minutes. Second, you need a separate Install Tool password.

Login in TYPO3

TYPO3 checks logins through a chain of authentication services.

1 processLoginDataFE prepare the login data 2 getUserFE find the user 3 authUserFE authenticate the user Return value of authUser ≤ 0 failure, stop 1–99 success, further services check 100–199 not responsible, continue ≥ 200 success, stop
First prepare, then find, then check.

First, TYPO3 calls initAuth() on every service. The services run in order of decreasing priority and quality. A service does not have to implement every subtype. A custom LDAP service returns 100 for unknown users, and then the default login takes over. Users from external systems also need a record in fe_users or be_users. The module Configuration in the System area shows the registered services.

Sessions: As long as a session is valid, TYPO3 does not check the login again. After login, TYPO3 assigns a new session ID. A planted ID becomes worthless, which prevents session fixation. The session cookie has three protective attributes:

  • HttpOnly: JavaScript cannot read the cookie.
  • Secure: TYPO3 sets it automatically if the request comes via HTTPS.
  • SameSite: It is lax in the frontend and strict in the backend. The value None requires Secure, and therefore HTTPS.

Passwords are stored only as a hash, with Argon2id by default. It is deliberately slow and cannot be reversed. Encryption would be wrong: leak the key, and everything is lost. MD5 or SHA-256 are far too fast, and an HMAC is meant for signatures. Your extension hashes its own passwords like the Core.

$hashInstance = $passwordHashFactory->getDefaultHashInstance('FE');
$hash = $hashInstance->getHashedPassword($password);
$ok = $hashInstance->checkPassword($password, $hash);
Code example. The PasswordHashFactory returns the default algorithm for the frontend. getHashedPassword creates the hash, checkPassword later checks an input.

Password policy: The policy default requires at least 8 characters, one uppercase and one lowercase letter, one digit and one special character. A new password must not be the same as the current one. The Core does not check against known data leaks.

Failed attempts: After 5 failed backend logins within 15 minutes, TYPO3 temporarily blocks further attempts from this IP address. In the frontend the limit is 10. The account itself stays open, otherwise attackers could lock out real users.

Multi-factor authentication: The Core ships two methods. TOTP creates a new code every 30 seconds in an authenticator app. Recovery codes are fallback codes for a lost phone, only usable on top of another method. SMS or email codes need extensions. You make MFA mandatory with requireMfa in the BE section:

  • 0 turns the requirement off, 1 applies to all users.
  • 2 applies only to users without admin rights, 3 only to administrators.
  • 4 applies only to system maintainers.

The option auth.mfa.required in User TSconfig sets it differently for individual users or groups and takes precedence.

Content Security Policy

A Content Security Policy, CSP for short, is an HTTP header. It tells the browser where it may load scripts, styles and images from. So it protects against injected scripts, but it does not replace escaping.

Enabling: In the backend, TYPO3 always enforces the CSP. In the frontend it is off by default. You enable it with one of two feature toggles, for enforcing or only for reporting.

security.frontend.enforceContentSecurityPolicy
security.frontend.reportContentSecurityPolicy
The two feature toggles are called security frontend enforce Content Security Policy and security frontend report Content Security Policy.

Alternatively, a site's csp.yaml file sets the disposition enforce or report.

An extension's rules live in the file ContentSecurityPolicies.php in the Configuration folder. It returns a map that assigns a MutationCollection to a scope. The scope, frontend or backend, is mandatory.

return Map::fromEntries([
    Scope::frontend(),
    new MutationCollection(
        new Mutation(MutationMode::Extend, Directive::FrameSrc, new UriValue('https://maps.example.com')),
    ),
]);
Code example. For the frontend, a mutation extends the directive frame-src with a map provider.

The modes are set, append, extend, reduce and remove. In addition there are inherit-once and inherit-again, which take over sources from default-src.

The browser blocks inline scripts. You allow one specifically with a nonce, a random value per request.

<script nonce="{f:security.nonce(directive: 'script-src')}">…</script>
Fluid example. The script tag gets a nonce attribute from the ViewHelper security.nonce for script-src.

The value unsafe-inline would allow every inline script and defeat the protection.

New in TYPO3 14: A nonce makes every response unique, so the page cannot be cached. Since version 14.2, TYPO3 can collect hashes of scripts and styles instead. A hash stays the same. This is an opt-in per site in the csp.yaml file.

behavior:
  useHash: true
  useNonce: false
YAML example. In the behavior section, useHash is on and useNonce is off.

CVE and updates

A CVE is a unique identifier for a publicly known security vulnerability, in the format CVE, year, number. CVSS describes the severity from 0 to 10. From 9.0, a vulnerability counts as critical. The TYPO3 Security Team publishes security advisories such as TYPO3-CORE-SA with year and number. They refer to the CVE.

This is how you stay informed:

  • You follow the advisories on typo3.org via mailing list or feed.
  • You check packages for known vulnerabilities with composer audit.
  • You look for security updates on the status page in the backend.

Key points

  • Every input is suspicious, including cookies, headers and external APIs.
  • Validation rejects, sanitizing changes. Check on the server with an allowlist.
  • Escape for the target: named parameters for SQL, escaping for HTML.
  • A token bound to the session helps against CSRF.
  • Authentication clarifies who someone is, authorization what they may do.
  • Passwords are Argon2id hashes, MFA brings TOTP and recovery codes.
  • CSP is an opt-in in the frontend, extensions ship rules per scope.
  • A CVE names a vulnerability, CVSS rates it. You install patch updates right away.

Terms

Allowlist
List of permitted values, everything else is rejected.
CSRF
A forged request in the name of a logged-in user.
CVE
Identifier of a publicly known security vulnerability.
CVSS
Rating of a vulnerability's severity from 0 to 10.
HMAC
Signature with a secret key that reveals every change.
Nonce
Random value that is new for every request.
Path traversal
Access to files outside the allowed folder.
XSS
Injected script that runs in the browser of other visitors.

As of: November 15, 2026 (TYPO3 14.3 LTS)

Sources:

  • TYPO3 Explained 14.3, chapters Security Guidelines, Authentication, Multi-factor authentication, Password policies, Rate limiting and Content Security Policy
  • Changelog TYPO3 14.0 to 14.3 (Authorize, CSP hashes, sanitizeLocalUrl)
  • Source code TYPO3 14.3 (typo3/cms-core, cms-extbase, cms-install), checked for default values, mutation modes and request tokens
  • OWASP Top 10 and OWASP Cheat Sheets
  • Learning objectives TYPO3 CMS Certified Developer 14 LTS, area Security

This study guide was written with AI and checked against the sources.

Certifications & exams

Which exam comes next?

You can already practise for 51 exams, and 16 are up for a vote. See all certifications with their official information, cast your vote or suggest your exam.

See all certifications