There were two main cases where German code-breakers cracked Allied codes. The first concerned the codes used by the Royal Navy, and by Allied merchants. These were book-codes, and comparatively simple to crack compared to cipher machines like Enigma, the British Typex or the American SIGABA. The Kriegsmarine's codebreaking group, the B-Dienst, could break and read most of those used in the early part of the war, up until 1942-43 depending on what they were trying to read. At the outbreak of war, they could read enough of the RN's codes to be aware of the location of every major warship. They had penetrated enough of the USN's codes to make a major contribution to the success of Operation Drumbeat, the attacks by German submarines on merchant traffic along the US East Coast. However, as new codes were introduced, they began to struggle slightly. The Royal Navy introduced Naval Cipher No 3 in October 1941. The B-Dienst broke it by early March 1942, and were able to crack ~80% of the messages sent in it. However, only about 10% of those messages were read early enough to take action. Despite this, they were able to organise some highly effective attacks on convoys, including wolfpack attacks against ON 166, HX 237 and SC 129 based on signals intelligence.
The second focussed on a code used by the US State Department, known as the Black Code. This was both broken by German cryptanalysts, and stolen by Italian intelligence. The State Department, unaware of this, used it for communicating with embassies. The military attache at the US embassy in Cairo, a Colonel Bonner Fellers, was ordered to create reports on British forces fighting in North Africa, and to send the reports in the Black Code. He was given full access to Eighth Army's command structure. Topics of his reports included attempts to resupply Malta, British strengths and losses, and planned commando raids. As the Germans could read every message he sent, they were as aware of the plans, dispositions and weaknesses of the British as he was. An example message from Fellers, on British tank strength, shows how useful this information was:
Estimates (Cairo) on equipment (British Army) serviceable tanks in Libya: 328; repairable tanks in Libya 521. Total tanks sent to Libya November 16, to January 8 is 1,276. Tanks evacuated from Libya 153. Tanks destroyed (British) 274. 674 of the 1,276 tanks sent in to Libya probably repairable damage
This information was passed to the relevant commanders, and they were able to use this to full advantage. In some cases, this information reached German commanders just two hours after Fellers sent it. Messages sent by Fellers were the likely causes for the heavy losses suffered by the ships involved in Operations Harpoon and Vigorous (simultaneous attempts to resupply Malta from the west and east respectively), and the failure of commando raids on airfields intended to support those operations.
Sources:
Battle of the Atlantic: Allied Communication Intelligence December 1942 - May 1945, SRH-009, NSA, http://www.ibiblio.org/hyperwar/ETO/Ultra/SRH-009/
German Naval Codebreakers, Jak Mallmann Showell, US Naval Institute Press, 2003
Turning the Hinge of Fate: Good Source and the UK-U.S. Intelligence Alliance, 1940–1942, C. J. Jenner, Diplomatic History (2008) 32 (2): 165-205