The DebtRank algorithm has been increasingly investigated as a method to estimate the impact of shocks in financial networks, as it overcomes the limitations of the traditional default-cascade approaches. Here we formulate a dynamical microscopic theory of instability for financial networks by iterating balance sheet identities of individual banks and by assuming a simple rule for the transfer of shocks from borrowers to lenders. By doing so, we generalise the DebtRank formulation, both providing an interpretation of the effective dynamics in terms of basic accounting principles and preventing the underestimation of losses on certain network topologies. Depending on the structure of the interbank leverage matrix the dynamics is either stable, in which case the asymptotic state can be computed analytically, or unstable, meaning that at least one bank will default. We apply this framework to a dataset of the top listed European banks in the period 2008 - 2013. We find that network effects can generate an amplification of exogenous shocks of a factor ranging between three (in normal periods) and six (during the crisis) when we stress the system with a 0.5% shock on external (i.e. non-interbank) assets for all banks.