LinuxQuestions.org
Share your knowledge at the LQ Wiki.
Home Forums Tutorials Articles Register
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Security
User Name
Password
Linux - Security This forum is for all security related questions.
Questions, tips, system compromises, firewalls, etc. are all included here.

Notices


Reply
  Search this Thread
Old 11-24-2014, 09:56 AM   #1
roby84
LQ Newbie
 
Registered: Aug 2012
Posts: 5

Rep: Reputation: Disabled
Strange messages about "cookie file" in Apache error_log file


Hello,

I have a Centos 6 server that I use to host some websites, and few days ago some strange messages start appearing in my Apache error_log file (/var/log/httpd/error_log), and I don't know what they mean, and if it is something bad or normal.

The message is the following:

# Netscape HTTP Cookie File
# http://curl.haxx.se/rfc/cookie_spec.html
# This file was generated by libcurl! Edit at your own risk.

#HttpOnly_.facebook.com TRUE / FALSE 1472112725 datr 3rvzVL_80MSwtcNW5K8WSoJ


It appears with a frequency of about once every hour.

So far I couldn't identify what website is generating these messages. I searched for some keywords inside websites logs but I found nothing relevant (if you know the right string to search inside logs please tell me). Moreover I would like to know where the file mentioned in the message is located.

Can anyone help me?

Thank you.

Roberto

Last edited by roby84; 11-25-2014 at 02:48 AM.
 
Old 11-24-2014, 12:41 PM   #2
Doc CPU
Senior Member
 
Registered: Jun 2011
Location: Stuttgart, Germany
Distribution: Mint, Debian, Gentoo, Win 2k/XP
Posts: 1,099

Rep: Reputation: 344Reputation: 344Reputation: 344Reputation: 344
Hi there,

Quote:
Originally Posted by roby84 View Post
I have a Centos 6 server that I use to host some websites, and few days ago some strange messages start appearing in my Apache error_log file (/var/log/httpd/error_log), and I don't know what they mean, and if it is something bad or normal.

The message is the following:

Code:
# Netscape HTTP Cookie File
# http://curl.haxx.se/rfc/cookie_spec.html
# This file was generated by libcurl! Edit at your own risk.

#HttpOnly_.facebook.com TRUE    /       FALSE   1472112725      datr    3rvzVL_80MSwtcNW5K8WSoJ

It appears with a frequency of about once every hour.
this is definitely not an Apache message, and so (IMO) something that SHOULD NOT appear in Apache's error log. It looks like a fragment of a configuration file (curl?), but I'm curious as hell how this ends up in Apache's error log. Could an Apache module or CGI possibly be writing its own messages into the log file?

Regular error log messages start with a timestamp, followed by "[error]" or "[notice]"; rarely they begin with "apache2:" followed by a message in prose.

Quote:
Originally Posted by roby84 View Post
So far I couldn't identify what website is generating these messages. I searched for some keywords inside websites logs but I found nothing relevant (if you know the right string to search inside logs please tell me). Moreover I would like to know where the file named in the message is located.
What file??

[X] Doc CPU
 
Old 11-25-2014, 02:48 AM   #3
roby84
LQ Newbie
 
Registered: Aug 2012
Posts: 5

Original Poster
Rep: Reputation: Disabled
Quote:
Originally Posted by Doc CPU View Post
Hi there,


this is definitely not an Apache message, and so (IMO) something that SHOULD NOT appear in Apache's error log. It looks like a fragment of a configuration file (curl?), but I'm curious as hell how this ends up in Apache's error log. Could an Apache module or CGI possibly be writing its own messages into the log file?

Regular error log messages start with a timestamp, followed by "[error]" or "[notice]"; rarely they begin with "apache2:" followed by a message in prose.
It's not unusual for me to see messages not beginning with [error] or [notice] inside Apache error log (i.e. curl), but I think it just depends on how Apache logging is configured.


Quote:

What file??

[X] Doc CPU
The file mentioned in the message, which says "This file was generated by libcurl! Edit at your own risk."
 
Old 11-25-2014, 04:52 AM   #4
Guttorm
Senior Member
 
Registered: Dec 2003
Location: Trondheim, Norway
Distribution: Debian and Ubuntu
Posts: 1,453

Rep: Reputation: 447Reputation: 447Reputation: 447Reputation: 447Reputation: 447
Hi

If you use a CGI or a PHP script that uses exec or similar to run some shell script, any output to standard error (stderr) is sent to the Apache error log. It doesn't have to be PHP, any scripting languge that lets you run shell commands can do this.

I would grep for curl to find out what is causing it. The cookie file is used when you want to automate things. For example you can use curl to login to some site, and then store the session cookie in a file. Then you can use curl with the cookie file to get stuff that require login. And from the error messages it looks like it's facebook.

So, if you have some code that does a facebook login and does something with facebook, it's probably the cause. If you find out it's harmless, you can add "2>/dev/null" to the curl shell command and this doesn't show up in the error log.
 
Old 11-25-2014, 05:28 AM   #5
Doc CPU
Senior Member
 
Registered: Jun 2011
Location: Stuttgart, Germany
Distribution: Mint, Debian, Gentoo, Win 2k/XP
Posts: 1,099

Rep: Reputation: 344Reputation: 344Reputation: 344Reputation: 344
Hi there,

Quote:
Originally Posted by Guttorm View Post
If you use a CGI or a PHP script that uses exec or similar to run some shell script, any output to standard error (stderr) is sent to the Apache error log. It doesn't have to be PHP, any scripting languge that lets you run shell commands can do this.
just like that, without further tricks? I didn't know that, thanks.
Doesn't this imply that output from a PHP script (just as an example) that is explicitly written to stderr also ends up in Apache's error log?

I never bothered to try, but that would be the logical consequence ...

[X] Doc CPU
 
Old 11-25-2014, 07:29 AM   #6
Habitual
LQ Veteran
 
Registered: Jan 2011
Location: Abingdon, VA
Distribution: Catalina
Posts: 9,374
Blog Entries: 37

Rep: Reputation: Disabled
Quote:
Originally Posted by roby84 View Post
Hello,

I have a Centos 6 server that I use to host some websites, and few days ago some strange messages start appearing in my Apache error_log file...inside websites logs
CentOS 6 what?
Code:
lsb_release -d
websites is plural, so are there any too permissive permissions on directories and files?
Directories on websites should be 755 and files should be 644 with the exception of cgi scripts.
Examine the /tmp directory closely.

I'd grab the exact date/time stamp from the apache log and document that somewhere for comparison. See http://www.cyberciti.biz/faq/unix-li...on-given-date/ for some comparison techniques against the timestamp on the apache log.

Check:
Code:
grep curl /var/log/yum.log
rpm -ql curl
md5sum /usr/bin/curl
output from those please.

Quote:
Originally Posted by roby84 View Post
It appears with a frequency of about once every hour
This suggests a cron job. How many users on the system?
Try
Code:
for i in /var/spool/cron/*; do echo $; sed 's/^//' $i; echo; done | grep -v "#"
as root to see crons for users of the system.
Examine files in etc/cron.* directories for curl commands.
Code:
grep curl /etc/cron.* -R
I'd remove the curl package if you don't use it, or none of the sites use it.

Have a look at https://www.rfxn.com/projects/linux-malware-detect/ and
http://rkhunter.sourceforge.net/ and clamav

Last edited by Habitual; 11-25-2014 at 07:32 AM.
 
Old 11-25-2014, 08:37 AM   #7
Guttorm
Senior Member
 
Registered: Dec 2003
Location: Trondheim, Norway
Distribution: Debian and Ubuntu
Posts: 1,453

Rep: Reputation: 447Reputation: 447Reputation: 447Reputation: 447Reputation: 447
Hi again

I doubt it is cron, then it wouldn't be in the Apache error log.

Quote:
Doesn't this imply that output from a PHP script (just as an example) that is explicitly written to stderr also ends up in Apache's error log?
Yes, it's easy to mess up the Apache error log that way. Try this:

Code:
file_put_contents("php://stderr","Weird log message without a newline!");
It ends up in the error log, and becuase of no trailing newline, it looks like a prefix to the next error message.
 
Old 11-25-2014, 11:20 AM   #8
Doc CPU
Senior Member
 
Registered: Jun 2011
Location: Stuttgart, Germany
Distribution: Mint, Debian, Gentoo, Win 2k/XP
Posts: 1,099

Rep: Reputation: 344Reputation: 344Reputation: 344Reputation: 344
Hi there,

Quote:
Originally Posted by Guttorm View Post
Yes, it's easy to mess up the Apache error log that way. Try this:

Code:
file_put_contents("php://stderr","Weird log message without a newline!");
It ends up in the error log, and becuase of no trailing newline, it looks like a prefix to the next error message.
there's hardly a day without learning something. :-)
Thank you for confirming the thought.

[X] Doc CPU
 
  


Reply



Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off



Similar Threads
Thread Thread Starter Forum Replies Last Post
"gethostby*.getanswer: asked for "", got "." on messages file wwipro Linux - Server 0 08-06-2013 09:45 PM
[SOLVED] Use "Tail -f" with log file to sound error on predefined messages Southpaw94 Linux - Server 2 06-20-2013 11:55 AM
What does "SFW2-INext-DROP-DEFLT" in my messages log file mean? TrulyTessa Linux - Networking 11 12-22-2004 09:28 AM
Apache error_log "file not found" question WorldBuilder Linux - Networking 4 11-26-2003 12:53 PM

LinuxQuestions.org > Forums > Linux Forums > Linux - Security

All times are GMT -5. The time now is 03:53 PM.

Main Menu
Advertisement
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
Open Source Consulting | Domain Registration