A Trust Evaluation Framework in Distributed Networks: Vulnerability Analysis and Defense Against Attacks