Please whitelist cPanel in your adblocker so that you’re able to see our version release promotions, thanks!

The Community Forums

Interact with an entire community of cPanel & WHM users!

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:
    3
    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 Technical Support Community Manager
    Staff Member

    Joined:
    Apr 11, 2011
    Messages:
    44,809
    Likes Received:
    1,898
    Trophy Points:
    363
    cPanel Access Level:
    Root Administrator
    Twitter:
    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.
     
    Stop hovering to collapse... Click to collapse... Hover to expand... Click to expand...
  3. cPanelPeter

    cPanelPeter Technical Analyst III
    Staff Member

    Joined:
    Sep 23, 2013
    Messages:
    575
    Likes Received:
    20
    Trophy Points:
    143
    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.
     
    Stop hovering to collapse... Click to collapse... Hover to expand... Click to expand...
  4. sjwrick

    sjwrick Member

    Joined:
    Jan 9, 2014
    Messages:
    8
    Likes Received:
    1
    Trophy Points:
    3
    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:
    1,011
    Likes Received:
    88
    Trophy Points:
    78
    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

  1. This site uses cookies to help personalise content, tailor your experience and to keep you logged in if you register.
    By continuing to use this site, you are consenting to our use of cookies.
    Dismiss Notice