The moral filth that Thoreau wanted to get rid of was the idea that the United States had the right to use its power for its own purposes -- even for purposes that were morally wrong.
Thoreau was very opposed to the war with Mexico (1846-8). He thought that the US had no right to go to war just to take land. He was also appalled at the idea that the land the US took might end up being worked by slaves. If this happened, the US would have taken land from another country by force and would have used that land in a system that exploited human beings and treated them as property.