Hacking
TYPO3
Oliver Hader
oliver@typo3.org
@ohader
TYPO3camp Mitteldeutschland
January 2019
T3CMD19 TYPO3camp Mitteldeutschland 2019 - Hacking TYPO3
~# whoami
2
▪~# whoami
▪Oliver Hader, M.Sc.
▪50% freelance web software engineer
▪50% employed at TYPO3 GmbH, Düsseldorf
▪TYPO3 security team lead (since 2019)
▪#hof, #cycling, #paramedic, #in.die.musik
T3CMD19 TYPO3camp Mitteldeutschland 2019 - Hacking TYPO3
Basic Basics
3
T3CMD19 TYPO3camp Mitteldeutschland 2019 - Hacking TYPO3
Web Application Security
4
▪ CIA/compliance triad
▪ confidentiality
▪ private, personal, sensitive information
▪ integrity
▪ manipulation of information (“fake news”)
▪ availability
▪ denial of service
▪ online bank account
▪ blocking information flow
https://www.ibm.com/blogs/cloud-computing/2018/01/16/drive-compliance-cloud/
T3CMD19 TYPO3camp Mitteldeutschland 2019 - Hacking TYPO3 5
Web Application Security
Open Web Application Security Project - TOP 10 vulnerabilities
https://www.owasp.org/images/7/72/OWASP_Top_10-2017_%28en%29.pdf.pdf
TYPO3 core TYPO3 3rd party extensionsPHP world
TYPO3vulnerabilitiesinpast5years
T3CMD19 TYPO3camp Mitteldeutschland 2019 - Hacking TYPO3 6
Web Application Security
OWASP - Application Security Risks
https://www.owasp.org/images/7/72/OWASP_Top_10-2017_%28en%29.pdf.pdf
T3CMD19 TYPO3camp Mitteldeutschland 2019 - Hacking TYPO3
Exam
7
T3CMD19 TYPO3camp Mitteldeutschland 2019 - Hacking TYPO3
Exam
8
▪ $contentId = $_GET['id'] ?? 1;
▪ $statement = $connection->query($q="
▪ SELECT header,bodytext FROM tt_content
▪ WHERE uid='$contentId'
▪ ");
▪ $content = $statement->fetch();
T3CMD19 TYPO3camp Mitteldeutschland 2019 - Hacking TYPO3
Exam
9
▪ sqli.php?id=1%27%20UNION%20SELECT%20

username%20password%20FROM%20be_users

%20LIMIT%201,1%20--%20
▪ SELECT header, bodytext FROM tt_content

WHERE uid='1' UNION SELECT username,
password FROM be_users LIMIT 1,1 –– '
▪ Reflected SQL Injection (retrieving values)
T3CMD19 TYPO3camp Mitteldeutschland 2019 - Hacking TYPO3
Exam
10
▪ $contentId = $_GET['id'] ?? 1;
▪ // alright, what shall we do here?
▪ $contentId = htmlspecialchars($contentId);
▪ $statement = $connection->query($q="
▪ SELECT header,bodytext FROM tt_content
▪ WHERE uid='$contentId'
▪ ");
▪ $content = $statement->fetch();
T3CMD19 TYPO3camp Mitteldeutschland 2019 - Hacking TYPO3
Exam
11
▪ $contentId = $_GET['id'] ?? 1;
▪ // alright, what shall we do here?
▪ $contentId = escapeshellarg($contentId);
▪ $statement = $connection->query($q="
▪ SELECT header,bodytext FROM tt_content
▪ WHERE uid='$contentId'
▪ ");
▪ $content = $statement->fetch();
T3CMD19 TYPO3camp Mitteldeutschland 2019 - Hacking TYPO3
Exam
12
▪ $contentId = $_GET['id'] ?? 1;
▪ // alright, what shall we do here?
▪ $contentId = $connection->quote(contentId);
▪ $statement = $connection->query($q="
▪ SELECT header,bodytext FROM tt_content
▪ WHERE uid='$contentId'
▪ ");
▪ $content = $statement->fetch();
T3CMD19 TYPO3camp Mitteldeutschland 2019 - Hacking TYPO3
Exam
13
▪ $contentId = $_GET['id'] ?? 1;
▪ // alright, what shall we do here?
▪ $contentId = (int)contentId;
▪ $statement = $connection->query($q="
▪ SELECT header,bodytext FROM tt_content
▪ WHERE uid='$contentId'
▪ ");
▪ $content = $statement->fetch();
Hacking
Playground

https://github.com/
ohader/typo3v9-
hack/
14T3CMD19 TYPO3camp Mitteldeutschland 2019 - Hacking TYPO3
T3CMD19 TYPO3camp Mitteldeutschland 2019 - Hacking TYPO3
Hi-Jacking &
Remote Control
thanks to Cross-Site Scripting
15
T3CMD19 TYPO3camp Mitteldeutschland 2019 - Hacking TYPO3 16
Insecure Install Tool Cookie (HTTP-only flag missing)
T3CMD19 TYPO3camp Mitteldeutschland 2019 - Hacking TYPO3 17
Browser Exploitation Framework (admin/joh316)
T3CMD19 TYPO3camp Mitteldeutschland 2019 - Hacking TYPO3
Upgrade User
Privileges
thanks to

Security Misconfiguration

& Insecure Deserialization
18
T3CMD19 TYPO3camp Mitteldeutschland 2019 - Hacking TYPO3 19
Retrieve current XSRF token
T3CMD19 TYPO3camp Mitteldeutschland 2019 - Hacking TYPO3 20
… the XSRF token to be used for next attack …
T3CMD19 TYPO3camp Mitteldeutschland 2019 - Hacking TYPO3 21
“Render” LocalConfiguration.php instead of Thumbnail
T3CMD19 TYPO3camp Mitteldeutschland 2019 - Hacking TYPO3 22
… what else can we find here?
T3CMD19 TYPO3camp Mitteldeutschland 2019 - Hacking TYPO3 23
Extbase __trustedProperties deserialisation
T3CMD19 TYPO3camp Mitteldeutschland 2019 - Hacking TYPO3 24
HMAC signing of __trustedProperties - based on encryptionKey
T3CMD19 TYPO3camp Mitteldeutschland 2019 - Hacking TYPO3 25
Common attack via GuzzleHttpPsr7FnStream callback
T3CMD19 TYPO3camp Mitteldeutschland 2019 - Hacking TYPO3 26
… having new “h4ck3r31” admin account …
T3CMD19 TYPO3camp Mitteldeutschland 2019 - Hacking TYPO3
“Anything”
thanks to insecure TypoScript

(Cross-Site Scripting & SQL Injection)
27
T3CMD19 TYPO3camp Mitteldeutschland 2019 - Hacking TYPO3 28
GET/POST data in TypoScript - insertData injection
T3CMD19 TYPO3camp Mitteldeutschland 2019 - Hacking TYPO3 29
… retrieving arbitrary values from database …
T3CMD19 TYPO3camp Mitteldeutschland 2019 - Hacking TYPO3 30
▪ TYPO3 Security Team needs YOU
▪ core, extension & infrastructure security
▪ GitHub, packagist.org - not only TER
▪ feedback, advise, educate
▪ analyse & hack (PoC)
▪ ask @ohader / oliver@typo3.org
TYPO3 Security Team

Hacking TYPO3 v9