  Due to the wide application of average consensus algorithm, its security and
privacy problems have attracted great attention. In this paper, we consider the
system threatened by a set of unknown agents that are both "malicious" and
"curious", who add additional input signals to the system in order to perturb
the final consensus value or prevent consensus, and try to infer the initial
state of other agents. At the same time, we design a privacy-preserving average
consensus algorithm equipped with an attack detector with a time-varying
exponentially decreasing threshold for every benign agent, which can guarantee
the initial state privacy of every benign agent, under mild conditions. The
attack detector will trigger an alarm if it detects the presence of malicious
attackers. An upper bound of false alarm rate in the absence of malicious
attackers and the necessary and sufficient condition for there is no
undetectable input by the attack detector in the system are given.
Specifically, we show that under this condition, the system can achieve
asymptotic consensus almost surely when no alarm is triggered from beginning to
end, and an upper bound of convergence rate and some quantitative estimates
about the error of final consensus value are given. Finally, numerical case is
used to illustrate the effectiveness of some theoretical results.
