EXHIBIT 23.1 Consent of Independent Registered Public Accounting Firm We consent to the incorporation by reference in the Registration Statement (Form S-8 No. 333-66440) pertaining to the Kerr-McGee Corporation Employee Stock Ownership Plan of our report dated May 28, 2004, with respect to the financial statements and schedules of the Kerr-McGee Corporation Employee Stock Ownership Plan included in this Annual Report (Form 11-K) for the year ended December 31, 2003. ERNST & YOUNG LLP Oklahoma City, Oklahoma June 18, 2004