Periodic Reporting for period 3 - Browsec (Foundations and Tools for Client-Side Web Security) Reporting period: 2021-06-01 to 2022-11-30 Summary of the context and overall objectives of the project Web applications play a fundamental role in our everyday life: thinkof e-commerce, e-banking, social networks, and so on. As such, theirsecurity is of paramount importance and the average user would expectthat modern web applications are bulletproof. Unfortunately, this is far from reality.The reason is that the Web has been originally designed to sharedocumens within a restricted scientific community, where everyonetrust each other. Hence browsers and web protocols have been largelydeveloped without placing security at the core of their design. As aresult, they are extremely fragile and they offer users littleprotection against common daily threats, such as the prying eyes oftrackers willing to collect any type of personal information in orderto serve better ads or more in general tailored content, or hackerswilling to steal credit card numbers, passwords, and other sensitivedata.The goal of Browsec is to design security solutions that providerigorous security guarantees and can be smoothly deployed by users intheir daily life. Specifically, the overall objectives include thedesign of formal methods to model and rigorously reason about thesecurity of web applications as well as the design of securityenforcement techniques that can be integrated in modern browsers. Onthe technical level, this encompasses semantics models of the browserand their security mechanisms, ideally formalized in proof assistants,dynamic security enforcement techniques implemented as browserextensions or server-side code as well as static analysis techniquesfor low-level code and web protocols.With a look at upcoming technologies, we will also explore security bydesign principles for blockchain technologies, which promise to play asignificant role in the future of Web applications and protocols,providing, e.g. the backbone for the decentralization of identifiers, data structures,and transactions. Work performed from the beginning of the project to the end of the period covered by the report and main results achieved so far The focus of Browsec is the enforcement of rigorous securityguarantees, which are grounded in semantic models capturing thebehaviour of programs and adversary, and against which formal security proofs areconducted. This is an innovative approach in Web security, in whichmost works focus on experimental evidence, without providing formalsecurity guarantees. We demonstrated the potential of our approach in WPSE, a browserextension that can be installed by users on their browser to securethe interaction with web protocols. WPSE secures web applications bylooking at their APIs -- which are intuitively the interfaces betweenweb applications, the browser, and the Internet -- without requiringany in-depth code analysis. This makes WPSE efficient and, at the sametime, capable to enforce formal security guarantees. In the process ofdesigning WPSE, we identified several vulnerabilies in popular webprotocols, such as Facebook OAuth and Google Single Sign-On, whichhave been responsibly disclosed and fixed. This work has been followedby a collaboration with SAP, which had led to the integration ofsimilar enforcement techniques on server-side code.Another major breakthrough is Horst, a new platform for the design ofstatic analysis techniques. The idea is to provide developers with auser-friendly specification language based on Horn clauses which getsautomatically compiled into an optimized SMT-Lib specification, whichis then accessible to off-the-shelf SMT solvers. This takes away theburden of engineering dedicated static analyzers, allowing developersto focus on the conceptual parts. We deployed Horst to derive Ethor,the first static analyzer for EVM bytecode -- the executable format ofEthereum smart contracts -- that provides formal security guaranteesagainst a semantic model of Ethereum smart contracts. We intend toleverage Horst as a verification backend of other low-level languages,such as WebAssembly, as well as web protocols.Another fundamental contribution is the line of work on blockchainprotocols. Here we designed a number of novel offchain protocols,which constitute the most promising approach to tackle the inherentscalability issues of blockchain technologies: the idea is to rely onthe blockchain only to resolve disputes, letting otherwise honestusers perform arbitrarily many transactions without need to storeanything on the blockchain. Our protocols are compatible with the mostpopular blockchain technologies (e.g. cryptocurrencies like Bitcoin,Ethereum, etc.) and offer interoperability, i.e. the possibility toperform transactions across different blockchains. Several of ourprotocols have already been integrated in industrial blockchainservices. Progress beyond the state of the art and expected potential impact (including the socio-economic impact and the wider societal implications of the project so far) We will continue our line of work with fundamental contributions ofgreat theoretical and practical impact.On the theory side, we will design an accurate model of the browser,integrating in particular the number of recently emerged securitymechanisms and formalizing their semantic and security properties. Weintend to formalize our model in a proof assistant compiling theresulting specification in SMT-Lib format, in order to support bothmanual and automated security proofs. We will also provide formalmethods to rigorously reason about the security of JavaScriptapplications, focusing in particular on fine-grained access control atthe web API level, and web protocols.On the practical side, we will design isolation mechanisms forJavaScript, static analyzers for Web Assembly and other low-levellanguages, and dynamic security enforcement techniques for web applications,covering readily deployable solutions like browser extensions as wellas alternative approaches, like code generated on the server-side aswell as plugins to be integrated in the browser architecture.Finally, we will further explore how blockchain protocols can beintegrated into web protocols in order to provide stronger securityguarantees.