Attack refers to the process of chemical corrosion of metal. It describes how corrosive agents (like acids, bases, or salts) damage or degrade metal surfaces.
To attack something by corrosion means to cause damage to it through a corrosive process. For example, a metal surface may be attacked by acid rain, leading to deterioration over time.