Skip to main content
Participant
August 31, 2012
Question

php virus written to CF temp file

  • August 31, 2012
  • 2 replies
  • 1807 views

We are encountering an issue with PHP virus files being written to the CF temp file location at \runtime\servers\coldfusion\SERVER-INF\temp\wwwroot-tmp. We have turned off file uploading scripts but we're still getting the virus files, usually in groups of three. Has anyone else seen this behavior?

Glenn Peterson

    This topic has been closed for replies.

    2 replies

    Charlie Arehart
    Community Expert
    Community Expert
    September 4, 2012

    Glenn, here are 3 things to consider about your challenge, first a way the files could be getting there, and then two tips about analyzing the web server logs for this:

    1) I can appreciate why you’d think that the files can only be uploaded to “uploading scripts”, and that if you’ve “turned them off” then it should no longer be possible for uploads to take place. But there’s at least one way that they could end up there. It’s a surprise to most folks: in fact ANY CF page can in fact receive a file uploads, and it will in fact be placed in that CF temp directory.

    Now, most folks understandably assume that only a page with a CFFILE Action=”upload” can “receive a file upload”, but all that tag really does is move the uploaded file from that temp directory to the location the tag’s DESTINATION attribute. But indeed any page can receive an uploaded file and will place it in that temp dir. For more on that, including demonstration code, see an old blog entry I did on it, http://www.carehart.org/blog/client/index.cfm/2006/5/7/cfform_not_doing_upload.

    But note there that I observed that a file uploaded to such a CF page should automatically be removed at the end of the request (at least it was back then when I wrote that in 2006). Are you seeing these files “stick around” a long time? If so, then there may be some change, or some other explanation. What version of CF is this on?

    2) As for trying to find evidence of the upload in the web server logs, while you can’t get them to list the files uploaded, you can enable them to track bytes received per request (the count of bytes received from the client to the server). You could then find which requests are doing any significant uploads, and for those, from what IP, and to what hostname and page.

    3) As for searching 2gb logs (mentioned in a later note in the thread), here are two tips for that. Of course, if you’re on Linux, GREP can handle that pretty well. On Windows, here are two free tools that can help: FileLocator Lite (to search for files by name or text, really fast, even gigs of file content), and Universal Viewer (which can open even a 2GB file in a second). I’ve blogged more on each of these:

    http://www.carehart.org/blog/client/index.cfm/2009/12/2/faster_better_file_searching

    http://www.carehart.org/blog/client/index.cfm/2010/10/15/viewing_large_log_files_with_universalviewer

    Let us know if any of this info helps.

    /charlie

    /Charlie (troubleshooter, carehart. org)
    glennpmnAuthor
    Participant
    September 4, 2012

    Thanks, Charlie, for taking the time to compose such a fulsome response. This information will be helpful. We think CF is behaving as it should (we're still on 8 at this point) and that we have mitigated risk to the point where we are comfortable. We are looking for areas we might have missed.

    Glenn

    Miguel-F
    Inspiring
    August 31, 2012

    Check your log files.  Can you tell where the files are being written from?  I mean, if they are coming from a file upload you should see the traffic in your webserver log files.

    glennpmnAuthor
    Participant
    August 31, 2012

    Thanks, checking the log files is a good idea (wish they weren't 2 Gig). What they're being written from is what we're trying to track down.

    Miguel-F
    Inspiring
    August 31, 2012

    You should be able to search the log files for the filename that was uploaded.

    What I meant by where they are being written is that if you find the log entry for when the file was uploaded it should also contain the ip address from where it came.  Hopefully you can track it down.