Are you just shaking it or tapping it? If just shaking it, does the sound appear to be coming from the lock button area? My wifes iPhone on Att had a bad rattle near the lock button just by shaking it. We took it to Apple and they gave us a new one. No problems since
Weird im just shaking it and if i put my finger on the lock button i get no rattle.
If it bothers you, exchange it. It bothered my wife due to some apps have a "shake to refresh". She no longer wanted to shake it. Her iPhone 4 came out of the box with this rattle. She exchanged it after having it maybe 3 weeks