Wireless sensor networks (WSNs) have become an important technology for execution of sensitive applications requiring real-time sensing and data acquisition for decision-making purposes. Apart from many challenges facing WSNs deployment and operations, security of wireless sensor networks is a an important challenging issue. There is always a potential threat of various types of malicious attacks against the security of WSNs. Due to the unreliable environments in which WSNs operate, the threat of distributed attacks against sensory resources such as power consumption, communication, and computation capabilities cannot be ignored. In this paper, a goal programming based approach is proposed and empirically analyzed in the context of distributed denial of service attacks in WSNs. The problem was analyzed using fuzzy logic approach in previous studies, but reflected some deficiencies in the proposed approach. The current goal programming based approach proposed herein is formulated as a multi-criteria decision-making problem, with attack detection rate and energy decay rate as the two decision criteria. A goal programming based mechanism is developed to achieve the best trade-off between the two aforementioned conflicting criteria. Empirical analysis proves the effectiveness of the proposed approach.