We reverse engineer dynamics of financial contagion to find the scenario of smallest exogenous shock that, should it occur, would lead to a given final systemic loss. This reverse stress test can be used to identify the potential triggers of systemic events, and it removes the arbitrariness in the selection of shock scenarios in stress testing. We consider in particular the case of distress propagation in an interbank market, and we study a network of 44 European banks, which we reconstruct using data collected from banks statements. By looking at the distribution across banks of the size of smallest exogenous shocks we rank banks in terms of their systemic importance, and we show the effectiveness of a policy with capital requirements based on this ranking. We also study the properties of smallest exogenous shocks as a function of the parameters that determine the endogenous amplification of shocks. We find that the size of smallest exogenous shocks reduces and that the distribution across banks becomes more localized as the system becomes more unstable.Systemic risk -the risk associated with the occurrence of a catastrophic breakdown of the financial systemarises endogenously from interactions between the participants that operate in financial markets. Because some types of interactions between financial institutions (in the following banks for brevity) can be modeled in terms of dynamical processes on networks, a growing body of literature has focused on the study of contagion and distress propagation in financial networks [1][2][3] . This research began in the year 2000 with the work of Allen and Gale, who showed that the topology of financial networks influences financial contagion 4 . Many different algorithms have since then been developed to model the propagation of distress between banks under different assumptions as well as to study the relation between the structure of a financial network and its stability (see for instance 3,[5][6][7][8][9][10][11][12][13][14][15][16][17][18][19][20][21] ). In this respect, significant progress has been made in the identification of the main drivers of financial contagion and in the design of new stress test frameworks that, at odds with standard micro-prudential tools, do account for interactions between banks 13,[21][22][23][24][25][26] . While the focus of research carried out so far has been mainly that of developing models to understand how exogenous shocks are amplified by the endogenous dynamics of the system, here we look at the reverse problem. We compute the time trajectories of smallest shocks that need to affect banks to produce a final loss of equity larger than a given threshold, which we therefore refer to as worst case shocks. The solution of this reverse problem is useful to identify stress scenarios whose occurrence would lead to systemic events, thus identifying the vulnerabilities of a financial system.At the level of individual institutions, reverse stress testing is a regulatory requirement in the United Kingdom (UK) and the European Union. The...