A characteristic of wireless sensor networks (WSNs) different from traditional networks is that WSNs are vulnerable to various types of attacks because of their distinctive features, involving distributed and nomadic attribute, wireless transmission medium, and lack of centralized infrastructure of security protection. Recently, Kumari et al presented a mutual authentication and key agreement scheme for WSNs using chaotic maps. Unfortunately, we find that the scheme of Kumari et al cannot resist sensor node capture attack, session‐specific temporary information attack, sensor node impersonation attack, and man‐in‐the‐middle attack. To overcome the security weaknesses in the solution of Kumari et al, this paper introduces a secure and efficient mutual authentication and key agreement scheme for heterogeneous ad hoc WSNs in fully public channel. Consequently, compared with the solution of Kumari et al, while providing relatively higher level of security and more security features, the proposed solution remains a favorable performance on communication overhead, computation overhead, and storage overhead separately.