While it’s true that butterflies suck nectar from flowers for nourishment, they also feed on on rotting fruit, animal dung and decaying corpses. Flowers alone do not provide enough sodium for butterflies, so they are attracting to salty things. If a butterfly has ever landed on you, it is because the butterfly was attracted by the smell of salt in your sweat and blood. (Source)