The Community Forums

Interact with an entire community of cPanel & WHM users!
  1. This site uses cookies. By continuing to use this site, you are agreeing to our use of cookies. Learn More.

trickle of unatuhorized email being sent from local

Discussion in 'Security' started by sjwrick, Jan 9, 2014.

  1. sjwrick

    sjwrick Member

    Joined:
    Jan 9, 2014
    Messages:
    8
    Likes Received:
    1
    Trophy Points:
    1
    cPanel Access Level:
    Root Administrator
    How can I tell which process is sending out emails?
    I am seeing bouncebacks and the email is being sent out by the main cPanel user (established when hosting account was created)

    The server is starting to get listed in a RBL

    Thanks Rick

    *********************************************

    from the log /var/log/exim_mainlog

    cwd=/home/**user**/public_html 5 args: /usr/sbin/sendmail -t -i -f alvin-1389283668@**domain**.com


    These are sending out emails from random addresses all aValidName-linuxtimestamp@theSamDomain.com

    aValidName = not a vaild user on the system - just a readable name.
    - = a hyphen
    linuxtimestamp = if you covert the seemingly random number it is a time stamp of when the email was sent.
    **domain* = the same domain each time.

    I know the domain in question.
    These are not smtp incoming emails they are generated by a process on the server as reflected in the mail headers.
     
  2. cPanelMichael

    cPanelMichael Forums Analyst
    Staff Member

    Joined:
    Apr 11, 2011
    Messages:
    30,852
    Likes Received:
    675
    Trophy Points:
    113
    cPanel Access Level:
    Root Administrator
    Hello :)

    The message logs you provided show that mail is coming from:

    /home/$username/public_html

    Check that directory for scripts with the ability to send out email.

    Thank you.
     
  3. cPanelPeter

    cPanelPeter Technical Analyst III
    Staff Member

    Joined:
    Sep 23, 2013
    Messages:
    569
    Likes Received:
    15
    Trophy Points:
    18
    cPanel Access Level:
    Root Administrator
    Twitter:
    Hello,

    I would search the public_html folder for the mail() function...

    Code:
    # grep -r 'mail(' *
    
    I'm betting some PHP script or plugin for WordPress/Joomla or other CMS software is poorly written and sending spam out.
     
  4. sjwrick

    sjwrick Member

    Joined:
    Jan 9, 2014
    Messages:
    8
    Likes Received:
    1
    Trophy Points:
    1
    cPanel Access Level:
    Root Administrator
    Yep it is a wordpress install there. Will analyze.

    - - - Updated - - -

    soooo many choices. Lots of work to do. :-(
     
  5. quizknows

    quizknows Well-Known Member

    Joined:
    Oct 20, 2009
    Messages:
    942
    Likes Received:
    57
    Trophy Points:
    28
    cPanel Access Level:
    DataCenter Provider
    Grepping recursively for the PHP mail function is a crap chute.

    First, check output from ps faux for any suspect PID's running as that user.

    Second, take the exact timestamp from one of the messages in exim mainlog, and try to match that up to the exact same time in the domains access logs. This is a much better way to search for spam from scripts.

    If that still leaves you scratching your head, clamav or maldet might find the script(s) if there is a malicious PHP mailer. Sometimes mail is sent from legitimate files (such as a "tell a friend" feature), so virus scanners won't find that.

    last ditch effort would be checking crontab or possibly grepping for the php mail function, but a lot of spam scripts just use an eval or exec call, or encoded code that will avoid being found with that grep command. You're almost better off looking for base64() calls instead of mail().
     
    #5 quizknows, Jan 9, 2014
    Last edited: Jan 9, 2014

Share This Page