Insurgents in Iraq have attacked the Abu Ghraib prison , outside Baghdad , injuring at least 18 American soldiers and 12 detainees .