<div dir="ltr"><div>YEAR/MONTH/DAY macros never contain spurious elements, as the timestamp is parsed by syslog-ng and these macros work from the parsed representation. They might be invalid (if parsing fails), but are guaranteed to contain only numbers.</div><div><br></div><div>The $HOST portion on the other hand is controlled by the syslog client and can contain this sequence of characters.</div><div><br></div><div>It is strange that "path" in the original log message seems to be empty, that should contain the filename that was suspicious to syslog-ng.<br></div></div><br><div class="gmail_quote"><div dir="ltr" class="gmail_attr">On Mon, Mar 2, 2020 at 3:39 PM Matus UHLAR - fantomas <<a href="mailto:uhlar@fantomas.sk">uhlar@fantomas.sk</a>> wrote:<br></div><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex">On 02.03.20 13:53, Antal Nemes (anemes) wrote:<br>
>I don't know why is this happening, but spurious path is the following:<br>
><br>
><a href="https://github.com/syslog-ng/syslog-ng/blob/52ef5c7072c651807cc2778000b3b8fe2a8cd101/modules/affile/file-opener.c#L74" rel="noreferrer" target="_blank">https://github.com/syslog-ng/syslog-ng/blob/52ef5c7072c651807cc2778000b3b8fe2a8cd101/modules/affile/file-opener.c#L74</a><br>
>For each opened file, syslog-ng checks some malicious patterns in the file name for security reason. If an attacker could inject `../../../` like macros, that could lead to write some unwanted system critical files.<br>
><br>
>File paths containing `../` or `/..` are called spurious paths in syslog-ng.<br>
<br>
that could explain is. macros in this line:<br>
<br>
>file("/var/log/netlog/unix/${HOST}/${YEAR}/${MONTH}/${HOST}-${YEAR}${MONTH}${DAY}.log"<br>
<br>
are the dates and times gotten from the message itself, so an attacker can<br>
send message containing suprious characters instead of real date.<br>
<br>
if you want to use date/time wen the message was received, use R_* macros<br>
(R_YEAR), or if you want to use date the messahe was processed/written, use<br>
D_* macros (D_YEAR).<br>
<br>
>________________________________<br>
>From: syslog-ng <<a href="mailto:syslog-ng-bounces@lists.balabit.hu" target="_blank">syslog-ng-bounces@lists.balabit.hu</a>> on behalf of Pal, Laszlo <<a href="mailto:vlad@vlad.hu" target="_blank">vlad@vlad.hu</a>><br>
>Sent: Monday, March 2, 2020 10:42<br>
>To: Syslog-ng users' and developers' mailing list <<a href="mailto:syslog-ng@lists.balabit.hu" target="_blank">syslog-ng@lists.balabit.hu</a>><br>
>Subject: [syslog-ng] Spurious path, logfile not created; path=<br>
><br>
>CAUTION: This email originated from outside of the organization. Do not follow guidance, click links, or open attachments unless you recognize the sender and know the content is safe.<br>
><br>
>Hi,<br>
><br>
>For one of my hosts, I can see lots of these messages<br>
><br>
>Spurious path, logfile not created; path=<br>
><br>
>What does it mean exactly? I'm creating files with this macro<br>
><br>
>file("/var/log/netlog/unix/${HOST}/${YEAR}/${MONTH}/${HOST}-${YEAR}${MONTH}${DAY}.log"<br>
><br>
>and even for this host, I have all the logs regardless of this message<br>
><br>
>I also have messages for the same host like this<br>
>Resource temporarily unavailable (11)<br>
><br>
>Here is some more details may help to find out the reasons behind this<br>
>- issue started 9th February (I have a total of 160K entries like this)<br>
>- the filename/path was incorrect during the whole event<br>
>2020/02/servername-20200210.log<br>
>- on 29th the server gone south by consuming lots of CPU and disappeared from the network, console was frozen, so we had to reset the vm<br>
><br>
>The host running an old syslog-ng PE<br>
>(syslog-ng-premium-edition 4 LTS (4.0.5a)<br>
>Installer-Version: 4.0.5a<br>
>Revision: ssh+git://ganesa@git.balabit//var/scm/git/syslog-ng/syslog-ng-pe--mainline--4.0#master#457ec2f494a46d62ecf8cd938f12f02cd0ae9e63)<br>
>on RHEL5<br>
><br>
>Log sources are simple plain text files contains tomcat and other web server logs<br>
><br>
>I have a twin-host with the exact same config and log sources, but I never seen messages like this from that one<br>
><br>
>Do you have any idea? To me it looks very mysterious<br>
<br>
-- <br>
Matus UHLAR - fantomas, <a href="mailto:uhlar@fantomas.sk" target="_blank">uhlar@fantomas.sk</a> ; <a href="http://www.fantomas.sk/" rel="noreferrer" target="_blank">http://www.fantomas.sk/</a><br>
Warning: I wish NOT to receive e-mail advertising to this address.<br>
Varovanie: na tuto adresu chcem NEDOSTAVAT akukolvek reklamnu postu.<br>
M$ Win's are shit, do not use it !<br>
______________________________________________________________________________<br>
Member info: <a href="https://lists.balabit.hu/mailman/listinfo/syslog-ng" rel="noreferrer" target="_blank">https://lists.balabit.hu/mailman/listinfo/syslog-ng</a><br>
Documentation: <a href="http://www.balabit.com/support/documentation/?product=syslog-ng" rel="noreferrer" target="_blank">http://www.balabit.com/support/documentation/?product=syslog-ng</a><br>
FAQ: <a href="http://www.balabit.com/wiki/syslog-ng-faq" rel="noreferrer" target="_blank">http://www.balabit.com/wiki/syslog-ng-faq</a><br>
<br>
</blockquote></div><br clear="all"><br>-- <br><div dir="ltr" class="gmail_signature">Bazsi</div>