1. We checked the scripts and compared with the latest scripts from the official site here. No suspcicious scripts were detected.
2. We modified the php.ini and increased the allowed memory but we still very often failed to upload attachements.
3. As a final measure, we rebooted the server which had been up running for more than 250 days.
After rebooting the server, we do not have problems uploading the attachments.
As for the error pages that contains the iframe, we guess they were carried over when we migrated from free hosting to the present dedicated server.
We only noticed the presence of those error pages since we were directed to that error page after failure of uploading attachments.
Since no true damages were observed so far, we just replaced those error pages with clean codes.
Thanks for you all providing good advises.