With increasing awareness of environmental protection, additional attention has been given to environmentally friendly metal anticorrosion research. In this paper, the green organic corrosion inhibitor sodium lignosulfonate (SLS) was extracted from bagasse waste, and a Ce-MOF@SLS smart anticorrosive film containing the inhibitor was prepared on the surface of an aluminum alloy by in situ electrodeposition. The material was characterized by SEM, EDS, FT-IR, XRD and XPS, and its corrosion resistance was tested with EIS and neutral salt spray tests. The electrochemical data showed that the Ce-MOF@SLS film reached a corrosion current density of 3.36 × 10