So a different question asked if the pentagon was a legitimate military target. And an answer ended up saying, that the law of war does not apply to a terrorist organization but rather civilian law.
This made me realize this seemingly inherent paradox in waging a war against organizations which are not considered states but at the same time claiming, that the law of war only applies to states.
So can you even fight a war against a civilian organization, or do you have to recognize something as a state to fight a war against it? Are you allowed to use the military against civilian targets?
If not, how is this resolved? Is everyone just going along with a violation of international law because it would be too complex to solve? Or is this covered by something else?
EDIT (Clarification): With "you" I mean any country which might want to fight such a war on terror. Given the current situation that means primarily western countries especially the US. But if the answer is different depending on the country I would also be interested in that. And "allowed" in the sense of commonly agreed upon international law.