''Contribute'' means ''to help a collective effort by giving something (like time or money) to it''.
For example, if you give volunteer to help a charity, you ''CONTRIBUTE to the cause''.
If you pay tax, you ''CONTRIBUTE to your country''.
'Normally, you ''attribute'' something to something else. ''Something else'' is the cause.
''The doctor ATTRIBUTED her illness to her soya allergy''. (The allergy is the cause of her illness)
It can also mean ''to associate something (often art) with a particular person, group or thing
For example, ''This style of writing can be ATTRIBUTED to the Victorians''.
''Attribute'' can also be a noun. It means ''quality'' or ''characteristic''.
As you can see, ''to contribute'' is often active and ''to attribute'' is often passive. Not always though:
''This information WAS CONTRIBUTED by Simon''. (passive)
''You can ATTRIBUTE this to the fact that I can't sleep''. (active)