The paper proposes an adaptive cruise control method for connected and automated vehicles (CAVs) with safety considerations against cyber attacks. A high-level layer is responsible for the computation of energy optimal speed profiles for the CAVs, considering oncoming road information such as terrain characteristics and speed limits. Due to the computationally cumbersome optimization method of the speed profile design, this step is performed in a cloud. Next, a feasibility analysis is carried out on the vehicle layer regarding safety of the CAVs, overwriting high-level speed references in case of a collision risk is detected. The aim of the present paper is to validate the above multi-layer control method with the design of an intelligent cyber attack using reinforcement learning techniques. Evaluating a multi-agent training with real data velocity profiles, each automated vehicle has been simulated to be attacked by an agent aiming to generate collisions in the vehicle string.