How can I quantify the impact of a change in interest rates on bond prices? I know that in a classical textbook setting the answer would be to compute the modified duration of the bond and, to account for large movement, to add also a convexity term. However, in real life, the term structure of interest rates it is not flat and does not always move in parallel. Am I correct in thinking that the only way is to take the current yield curve (e.g. the one provided in Bloomberg by the GC function), apply the desired shocks (for instance, +10bps to the 5 year maturity), and use it to reprice the bond? Or is there some form of closed-formula which can still be applied?
Let's think of the bond as a set of fixed cash-flows (which it is, unless it's a floating-rate bond). These cashflows consist of the coupons and the face-value paid at maturity.
Unless the coupons are large, the modified duration is still a pretty good "back-of-the-envelope" estimate of the bond sensitivity to rates change, because the main sensitivity comes from the face-value paid at maturity:
Say the bond matures in 10 years: then you can (simplistically) think of the modified duration as the sensitivity of the bond price to % change in the 10y point on the yield curve (indeed, in the "perverse" scenario where some other points on the yield curve would move significantly but the 10y point wouldn't change, the bond price would not change by that much: again, unless the coupons are large).
Indeed, if you wanted a very precise calculation where every 0.5 bps is relevant (i.e. huge notional, long-dated bond with many larger coupons, etc), then you'd want to reprice the bond using all points on the changed yield-curve.
But if you are trying to hedge the bond exposure, duration + convexity is your best bet anyway: because there are an infinite number of permutations in terms of what can happen to the yield curve, so if you wanted to hypothetically understand the impact of all of them on your bond price, you'd need to come up with all these scenarios and reprice the bond under each of them, which is unrealistic.
It depends on your bonds, and on the kind of risk scenarios you want to consider, and how you intend you use these numbers.
As Jan Stuller points out in his excellent answer, modified duration is usually the equivalent of a good first approximation of the bond's sensitivity to 1 basis point shock to the curve in parallel - dv01. Further, key rate durations provide an approxiate way to decompose the dv01 into tenor buckets, useful if the bonds pay large coupons, or amortize - have material cash flows before maturity. The bucketed dv01s should approximately add up to the parallel shift dv01. In an example use case where you want to figure out the notionals of interest rate swaps to hedge the inerest rate risk of a portfolio of bonds, and if you intend to dynamically re-calculate the hedges frequently enough, as the bucketed dv01s change with time, then this approximation may be accurate enough. Or not.
But there are a few situations where you may prefer to do something more complicated:
If the bond or a loan is a floater, paying coupon RFR + spread (or even RFR * gearing in some markets), and the interest rates move in parallel, then the coupons change to offset the change in the present value of the principal repayment. But the fixed spread contributes some interest rate risk. If your book has risky floaters paying spreads over RFR in the hundreds of basis points, you may prefer not to assume that they have no interest rate risk, but rather include it in your hedging. Also if you want to decompose the dv01 into tenor buckets, or if you want to know the impact of non-parallel curve perturbations (e.g. flatteners / steepeners scenarios), then the coupon changes no longer offset the principal.
Likewise, if the bond pays fixed coupon, but is trading at a price below that implied by just pricing its cash flows at RFR - then its price is probably driven down by something else - perhaps credit risk. It's likely that an interest rate shock will affect this bond less than it would affect a purely rates instrument.
One possible approach is to calculate a Z-spread-like idiosyncratic spread - solve for a parallel shift in the interest rates that would explain the observable bond price - then perturb the interest rates and reprice the bond's cash flows keeping the idiosyncratic spread constant.
For a lot of higher-yielding bonds this should provide better P&L explanation, and more effective hedges, than modified duration, in a sense that the Z-spreads would be stable day to day in the absense of idiosyncratic news. It doesn't really matter whether you use the general colateral curve (which is your cost of financing the bonds) or some other interest rate curve. But the assumption that the Z-spread would not change when interest rates move a lot isn't very realistic either. You don't want to base your decision to trade a corporate bond trading now at 300 bps Z-spread on the asumption that its Z-spread won't change when interest rates move 400 bps.
You might get better predictions for credit-risky bond prices if you make some assumption about the loss given default, then solve for either the probabilities of default or for CDS spreads implied by observed price, then reprice the cash flows using perturbed interest rates to discount.
Also, some bonds' cash flows have some optionality. Consider, for example, a bond paying 8% fixed, maturing in 10 years, but callable after 2 years. If the bond is not called until maturity, then it has a lot of interest rate risk. But if the bond issuer can refinance at 5% coupon rate because their credit has improved and/or the interest rates are down, then they will probably exercise the call, in which case there is less interest rate risk. Models that predict whether the debtors will exercise their options under interest rate shocks can get pretty hairy, particularly prepayment rate models for collateralized mortgage obligations and mortgage backed securities. My point is, very material higher-order relationship may be much more complicated than just rate convexity, and may affect the prices a lot under a large rates movement.