| Summary: | sshd syslogs raw untrusted data | ||||||
|---|---|---|---|---|---|---|---|
| Product: | Portable OpenSSH | Reporter: | Pavel Kankovsky <peak> | ||||
| Component: | sshd | Assignee: | OpenSSH Bugzilla mailing list <openssh-bugs> | ||||
| Status: | CLOSED FIXED | ||||||
| Severity: | normal | ||||||
| Priority: | P2 | ||||||
| Version: | -current | ||||||
| Hardware: | UltraSPARC | ||||||
| OS: | Solaris | ||||||
| Attachments: |
|
||||||
|
Description
Pavel Kankovsky
2002-02-13 10:20:29 AEDT
that's strange, either syslog() or syslogd should do vis() The OS was S-o-l-a-r-i-s. Not OpenBSD. :) we should perhaps vis(3) wrap log calls. I agree that it should be syslog's responsability to safely encode any untrusted data. I hope you filed a bug with Sun too :) Here's an untested patch which runs all syslog data through vis() Created attachment 79 [details]
Process all syslog data through vis()
A while ago vis.[ch] was removed because it wasn't used anywhere. This was helpful for another reason: AT&T's graphviz package defines a completely different vis() and has a vis.h. Since -I$(srcdir)/openbsd-compat was removed, it would always find the vis.h in /usr/local/include on systems with graphviz installed and die. If this patch goes in, it'd be nice if the prototype for vis() could be added someplace else, instead of relying on finding vis.h in the -I searchpath. Patch applied. I don't think there should be header file clashes with graphviz, but please file separate bug reports if there are. Mass change of RESOLVED bugs to CLOSED The current code in log.c fails to address the problem. It does
strnvis(fmtbuf, msgbuf, sizeof(fmtbuf), VIS_SAFE|VIS_OCTAL);
but this leaves nasty characters like LFs (misinterpreted by Solaris
syslog()...see above) alone.
On the other hand, stricter vis() flags make debugging output (sshd -d) ugly
because some debugging message include a "natural" newline.
I think the code should read:
strnvis(fmtbuf, msgbuf, sizeof(fmtbuf), log_on_stderr ?
VIS_SAFE|VIS_OCTAL : VIS_CSTYLE|VIS_NL|VIS_TAB|VIS_OCTAL);
Yes. Similar fix committed - thanks! |