Reaction for the corrosion of iron
Rusting of iron is an electrochemical phenomenon.
A certain site on the iron object acts as an anode.
$$\ce{(Fe(s) -&gt; Fe^2+(aq) + 2e ) × 2}$$ 
Electrons released at this spot go to another site on the object and reduce oxygen in presence of $\ce{H+}$ ions which are either obtained from water out from acidic substances in water:
$$\ce{H2O -&gt; H+ + OH-}$$
$$\ce{CO + H2O -&gt; H2CO3}$$
$$\ce{H2CO3 -&gt; 2H+ + CO3^2- }$$
This site behaves as cathode and reaction is 
$$\ce{4H+ + O2 + 4e -&gt; 2H2O}$$
Therefore the overall reaction is :
$$\ce{2Fe(s) + O2 + 4e -&gt; 2Fe^2+(aq) + 2H2O}$$
Now the ferrous ions are further oxidised by atmospheric oxygen to ferric ions which come out as rust in form of hydrated ferric oxides.
$$\ce{Fe^2+(aq) + 2H2O + 1/2O2 -&gt; Fe2O3 + 4H+(aq)}$$