The code dissemination in sensor networks is a useful technology to update a new code or change the functionality or bugs of the existing code. However, sensor networks are susceptible to various attacks because they are deployed in open and unprotected environments. It is necessary to use effective mechanisms to protect sensor nodes against attacks. In this paper, we propose a secure code dissemination mechanism over the energy-efficient minimum virtual backbone reducing the number of broadcasting packets using RSSI (Received Signal Strength Indicator) values. Our mechanism considers all security requirements such as the confidentiality, the integrity and the authentication to defend the battery exhaustion attack, the DoS attacks, the routing attacks, etc. during the code dissemination. We evaluated the performance of our method via simulations using QualNet, a kind of simulation tools. Simulation results show that our proposed mechanism significantly reduces the number of transmitted messages, the energy consumption and the computation overhead for the secure code dissemination in comparison to other existing secure code disseminations.