Purpose - The present work aims at studying the emergence of systemic crisis and the evolution of contagion in financial networks in presence of firms. Much of the literature in this field studies the effects on a stylized financial system of an initial exogenous shock, typically consisting in the default of a given bank. Although purely idiosyncratic shocks occur they are rare, moreover this sort of disturbance reflects only partially what happened in the recent crisis, which was indeed caused by a shock generated at real level (i.e. the inability of hundreds of thousands of American families of paying their mortgages). In this paper we provide a general framework to assess systemic risk when the shock is due to firms' default. Design/methodology/approach - We developed a model with two types of agents, banks and firms, linked one another in a two-layer network by their reciprocal claims. We used numerical simulations to investigate the emergence of systemic crisis and the evolution of contagion in presence of a shock at firms level. The shock that we impose on the system consists in the default of a given number of firms, which are assumed to become unable to pay back their loans. Banks exposed toward defaulted firms mark them as "bad loans" and reduce their value accordingly. In this way the original shock is transmitted to the financial network, which can absorb or amplify it, determining the default of one or more financial institutions. The model is calibrated with empirical data on the banking sector of Italy, Germany and United Kingdom. Originality/value - The work formalizes one aspect of the interplay between financial and real side of the economy, two worlds too often left separate from one another. Moreover, compared to other studies on this subject, it gives a more solid foundation for the initial shock and put emphasis on the relationships between banks and firms. Even though the model presented is a stylized representation of reality and its calibration is necessarily rough due to the lack of public available data, it provides a different and until now little explored insight for the emergence of systemic crisis, constituting a useful starting point for future research. Practical implications - This study shows how firms' default can generate systemic crisis in a financial network through the web of credit and debit relationships. The results of the simulations confirm the idea that a higher degree of interconnection is not always good for financial stability and that it may actually exacerbates contagion, contrasting with the standard view that diversification is the key element to reduce risk. The model is able to assess the frequency and the extent of a crisis and to track the evolution of contagion. From a regulatory point of view, the outcomes of the model suggest that banks' size distribution and capital ratio can make some countries more prone to systemic crisis than others.