In June 2008, the U.S. Supreme Court finally ruled definitively, in Boumediene v. Bush, that Guantánamo detainees are entitled, under the writ of habeas corpus, to challenge their detentions in federal district court.
Andy Worthington has compiled a list of all rulings to date here.