  We obtain a full characterization of Einstein-Maxwell $p$-form solutions
$(\boldsymbol{g},\boldsymbol{F})$ in $D$-dimensions for which all higher-order
corrections vanish identically. These thus simultaneously solve a large class
of Lagrangian theories including both modified gravities and (possibly
non-minimally coupled) modified electrodynamics. Specifically, both
$\boldsymbol{g}$ and $\boldsymbol{F}$ are fields with vanishing scalar
invariants and further satisfy two simple tensorial conditions. They describe a
family of gravitational and electromagnetic plane-fronted waves of the Kundt
class and of Weyl type III (or more special). The local form of
$(\boldsymbol{g},\boldsymbol{F})$ and a few examples are also provided.
