An ab initio study of OH radical substitution reactions in halogenated carbonyls is conducted. Hydroxyl radical substitution into oxalyl dichloride [ClC(O)C(O)Cl] and oxalyl dibromide [BrC(O)C(O)Br], resulting in the formation of oxalic acid, is presented. Analogous substitution reactions in formyl chloride [ClCH(O)], acetyl chloride [ClC(O)CH(3)], formyl bromide [BrCH(O)], and acetyl bromide [BrC(O)CH(3)] are considered. Energetics of competing hydrogen abstraction reactions for all applicable species are computed for comparison. Geometry optimizations and frequency computations are performed using the second-order Møller-Plesset perturbation theory (MP2) and the 6-31G(d) basis set for all minimum species and transition states. Single point energy computations are performed using fourth-order Møller-Plesset perturbation theory (MP4) and coupled cluster theory [CCSD(T)]. Potential energy surfaces, including activation energies and enthalpies, are determined from the computations. These potential energy surfaces show that OH substitution into ClC(O)C(O)Cl and BrC(O)C(O)Br, resulting in the formation of oxalic acid and other minor products, is energetically favorable. Energetics of analogous reactions with ClCH(O), BrCH(O), ClC(O)CH(3), and BrC(O)CH(3) are also computed.