An attacker driving an ambulance packed with explosives detonated them Saturday in Kabul, leaving 40 people dead and 140 others injured, Afghan officials said.