In order to solve various security risks faced by image privacy protection, we propose a 3D cuboid image encryption scheme based on message-encoded controlled alternate quantum walks. Firstly, we calculated the initial parameters of the quantum system and performed a one-dimensional quantum walk to generate a probability distribution sequence. Secondly, we encoded the sequence into a quaternary message using multiple sets of encoded messages to control the alternate quantum walk model, generating a 3D probability amplitude matrix and 3D probability distribution matrix to obtain the 3D quantum hash sequence through the 3D probability distribution matrix. Then, the image was divided into blocks and integrated into a cuboid. The image cuboid was scrambled between layers using the probability value sequence, and the 3D probability distribution matrix was used to complete the scrambling of the cross-section between layers. Finally, we converted each pixel value of the scrambled cuboid into a binary cube and controlled it to perform the rotation operation through the 3D probability magnitude matrix, then used the 3D quantum hash sequence to XOR the obtained cuboid image and tilted it to obtain the final encrypted image. The simulation results show that the image encryption scheme can resist various typical attacks and has good security performance.