Pedro Bernardo
I am a PhD student in the Security and Privacy research unit at TU Wien. My research focuses on the intersection between Web Security and Formal Methods, and I aim to contribute to the scientific community and the state-of-the-art with new techniques and methodologies to protect our fundamental rights to security and privacy in the digital world.
Outside of my reserach, I play CTF competitions with STT and w0y, where I get the opportunity to explore my passion for the low-level aspects of computer security. I have had the privilege of representing STT as a finalist in CSAW'20 CTF, and HITB Pro-CTF 2021 Finals. I also represented Team Portugal in the European Cybersecurity Challenge 2021
You can reach me by e-mail, or find me at room HA0110, Favoritenstrasse 9-11, 1040 Wien.
Publications
- Web Platform Threats: Automated Detection of Web Security Issues With WPT. USENIX Security Symposium (USENIX), 2024.
P. Bernardo, L. Veronese, V. Valle, S. Calzavara, M. Squarcina, P. Adão, M. Maffei.Abstract paper bibtex technical report
Client-side security mechanisms implemented by Web browsers, such as cookie security attributes and the Mixed Content policy, are of paramount importance to protect Web applications. Unfortunately, the design and implementation of such mechanisms are complicated and error-prone, potentially exposing Web applications to security vulnerabilities. In this paper, we present a practical framework to formally and automatically detect security flaws in client-side security mechanisms. In particular, we leverage Web Platform Tests (WPT), a popular cross-browser test suite, to automatically collect browser execution traces and match them against Web invariants, i.e., intended security properties of Web mechanisms expressed in first-order logic. We demonstrate the effectiveness of our approach by validating 9 invariants against the WPT test suite, discovering violations with clear security implications in 104 tests for Firefox, Chromium and Safari. We disclosed the root causes of these violations to browser vendors and standard bodies, which resulted in 8 individual reports and one CVE on Safari
- WebSpec: Towards Machine-Checked Analysis of Browser Security Mechanisms. IEEE Symposium on Security and Privacy (S&P), 2023.
L. Veronese, B. Farinier, P. Bernardo, M. Tempesta, M. Squarcina, M. Maffei.Abstract paper bibtex
The complexity of browsers has steadily increased over the years, driven by the continuous introduction and update of Web platform components, such as novel Web APIs and security mechanisms. Their specifications are manually reviewed by experts to identify potential security issues. However, this process has proved to be error-prone due to the extensiveness of modern browser specifications and the interplay between new and existing Web platform components. To tackle this problem, we developed WebSpec, the first formal security framework for the analysis of browser security mechanisms, which enables both the automatic discovery of logical flaws and the development of machine-checked security proofs. WebSpec, in particular, includes a comprehensive semantic model of the browser in the Coq proof assistant, a formalization in this model of ten Web security invariants, and a toolchain turning the Coq model and the Web invariants into SMT-lib formulas to enable model checking with the Z3 theorem prover. If a violation is found, the toolchain automatically generates executable tests corresponding to the discovered attack trace, which is validated across major browsers. We showcase the effectiveness of WebSpec by discovering two new logical flaws caused by the interaction of different browser mechanisms and by identifying three previously discovered logical flaws in the current Web platform, as well as five in old versions. Finally, we show how WebSpec can aid the verification of our proposed changes to amend the reported inconsistencies affecting the current Web platform.
- Systematic Analysis of Programming Languages and Their Execution Environments for Spectre Attacks. International Conference on Information Systems Security and Privacy (ICISSP), 2022.
A. Naseredini, S. Gast, M. Schwarzl, P. Bernardo, A. Smajic, C. Canella, M. Berger, & D. Gruss.Abstract paper bibtex
In this paper, we analyze the security of programming languages and their execution environments (compilers and interpreters) with respect to Spectre attacks. The analysis shows that only 16 out of 42 execution environments have mitigations against at least one Spectre variant, i.e., 26 have no mitigations against any Spectre variant. Using our novel tool Speconnector, we develop Spectre proof-of-concept attacks in 8 programming languages and on code generated by 11 execution environments that were previously not known to be affected. Our results highlight some programming languages that are used to implement security-critical code, but remain entirely unprotected, even three years after the discovery of Spectre.
- SpecTacle - A Platform-agnostic Analysis Tool for Detecting Spectre-PHT Gadgets in Binaries. Master's Thesis. 2021.
P. Bernardo.Abstract paper bibtex
Spectre attacks exploit one of the most effective CPU optimization techniques: speculative execution. Instructions executed speculatively can leave traces in microarchitectural structures that attackers can later recover using side-channels, enabling attackers to read arbitrary data. The adoption of speculative execution is widespread across today's CPU architectures, which means billions of devices are susceptible to Spectre attacks. As a result, CPU manufacturers have suggested using serializing instructions that effectively disable speculative execution for a given code segment as mitigation. However, to apply this technique while providing a good balance between security and performance, these vulnerable code snippets, called Spectre gadgets, must be first located. In this thesis, we contribute to the state-of-the-art in Spectre gadget detection. We implement SpecTacle, a tool that extracts potentially vulnerable control flow paths and performs static taint analysis to detect gadgets in such paths while producing a low number of false negatives without sacrificing execution time. Additionally, these potential gadgets are validated through symbolic execution. Finally, we show SpecTacle's efficacy through litmus tests and successfully apply it to a real-world example. In addition to the detection of Spectre-PHT gadgets, we adapt our tool to support the detection of gadgets that leak data through an AVX-based side-channel, not supported by any other state-of-the-art tool. These gadgets are used by NetSpectre, a Spectre variant that enables remote Spectre attacks. Finally, we propose an approach to statically detecting Spectre gadgets in JIT-compiled code, which until now has only been done dynamically, and validate this approach through a proof-of-concept.
Supervision: Pedro Miguel Adão and Daniel Gruss
Academic Service
- EuroS&P 2025, IEEE European Symposium on Security and Privacy. PC Member (mentee)
- S&P 2025, IEEE Symposium on Security and Privacy. Co-reviewer
- SecWeb 2024, SecWeb Workshop 2024, co-located with IEEE S&P. PC member (mentee)
- NDSS 2024, 2025, The Network and Distributed System Security Symposium. AEC member
- WOOT 2023, IEEE Workshop on Offensive Technologies, co-located with IEEE S&P. AEC member and Co-reviewer
- WOOT 2022, IEEE Workshop on Offensive Technologies, co-located with IEEE S&P. AEC member
Teaching
- 2024 (SS): lecturer, Introduction to Security (VU) [192.019], TU Wien
- 2024 (SS): lecturer, Formal Methods for Security and Privacy (VU) [192.059], TU Wien
- 2023 (SS): lecturer, Introduction to Security (UE) [192.082], TU Wien
- 2023 (SS): lecturer, Introduction to Security (VU) [184.783], TU Wien
CTF Writeups
- hfs_browser -- Midnight Sun CTF 2022 Quals writeup
midnightsunquals22 pwn javascript
Exploiting a Use-After-Free vulnerability in a JavaScript engine to get a libc leak and mount a Tcache poison attack to get RCE. All of it through JavaScript :D - ncore -- CSAW Quals 2021 writeup
csawquals21 rev verilog
Reverse engineer a Verilog VM and bruteforce an authentication key. - Dark Honya -- nullcon HackIM 2020 writeup
nullcon20 pwn
Null byte overflow on a heap chunk, which enables a use-after-free. Use unsafe-unlink to get a libc leak and a shell. - Random Vault -- Pwn2Win 2019 CTF writeup
pwn2win pwn shellcode srand
The program 2-shot format string: 1) bypass PIE; 2) modify srand seed and function pointer. The new seed lets us control the RIP so we can land on our shellcode. - lazy -- SECCON 2019 Online CTF writeup
seccon19 pwn formatstring
Exploit a buffer overflow to bypass a login check, into a format string vulnerability to dump the binary and libc. Exploit another buffer overflow into a ROP-chain to get a shell. - SPlaid Birch -- Plaid CTF 2019 writeup
plaid2019 pwn heap tcache
Out-of-bounds read (OOBR) allows ASLR leaks and double free. We use the OOBR to mount a Tcache poison attack and eploit the __free_hook pointer to get a shell. - shell->code -- CSAW2018 Quals writeup
csaw18 pwn shellcode
Buffer overflow into a multi-stage shellcode. First flag for STT <3
Media
- TUW Researchers contribute to the 33rd USENIX Security Symposium. TU Wien Cybersecurity Center (CYSEC)
- Portugal places 7th in the ECSC. Germany is the grand winner. Exame Informática, 2021
- They are young hackers, and they will defend the colors of Portugal in the european cybersecurity championship. Exame Informática, 2021
- Novabase challenges students to develop an application. Instituto Superior Técnico news, 2019
Recorded Talks
- USENIX Security '24 - Web Platform Threats: Automated Detection of Web Security Issues With WPT. USENIX Security Symposium (USENIX), 2024.
- WebSpec: Towards Machine-Checked Analysis of Browser Security Mechanisms. IEEE Symposium on Security and Privacy (S&P). 2023.
CVEs
- Safari CVE-2023-38592
- Firefox CVE-2024-6611