|
|
|
Javier Fernández-Sanguino-2
|
Some javascript/style in this post has been disabled (why?)
-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1 Adjointed is my proposed schema for the Debian GNU/Linux operating system. I have based it in both the Solaris and RedHat schema extending it somewhat. Please take a look at the new elements I have introduced in the schema, specially 'Debian_InetListeningServers', netstat (or lsof) needs to be used. IMHO if a given vulnerability might be on a local server, it's important not only to determine if the server is installed and configured to run, but also if it's in fact up and running (i.e. listening for connections). This could also be introduced in the the RedHat schema (copy & pasted) and Solaris (See below [1]) I've mainly added the following (as compared to RedHat's schema): - - SHA-1 filesums in the Debian_FileAttributes (could probably substitute MD5 in the future and is used by the "Know Googs Database" at http://www.knowngoods.org/download.html and NIST's NSRL: http://www.nsrl.nist.gov/) - - A Debian_Inetdconf table, similar to Solaris' table. - - A Debian_PKGinfo table (substitutes the RedHat_RPMinfo) that should store information on installed packages - - A Debian_Version table, to store which specific Debian version is in use. - - A Debian_Group table, to store information on user groups. - - A Debian_InetdListeningServer table (described above) Feel free to send any comments on this Draft Schema, I don't know who is in charge of the RedHat or Solaris schema but some of the tables introduced here could be introduced there too. I had promised this schema to Matthew Wojcik way back in December. I would like to apologise for not having posted it sooner. Best regards Javier Fernandez-Sanguino jfernandez@... Security Division Germinus http://www.germinus.com Madrid, Spain [1] In Solaris you could use 'netstat -an -f inet; netstat -an -f inet6' and you will not be able to retrieve the same information, for example, processes which have opened the connection or users running them. Unless you use 'lsof' or scripting like this (sample code, run at your own cost): - ---------------------------------------------------------------------- for pid in `ps -ef -o pid`; do ports=`pfiles $pid 2>/dev/null |grep "AF_INET 0\.0\.0\.0" |sed -e 's/.*port: \([ 0-9]*\).*/\1/g'` [ -n "$ports" ] && { name=`ps -p $pid -o fname |grep -v COMMAND`; echo "Process $name ($pid) listening on port $ports" ; } done - ---------------------------------------------------------------------- -----BEGIN PGP SIGNATURE----- Version: PGP 7.1.1 iQA/AwUBPpU07KO1I0N5hzVfEQK9SgCgl4ZWdy0WB+bRWKhj/C4C39MkihkAoJUs GCtO5RyVNbHbTQs6GtWz7cvo =uMxS -----END PGP SIGNATURE-----
|
|||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Wojcik, Matthew N.
|
I've converted Javier's proposed schema to plain text, for those who don't
deal well with HTML or attachments. If I've made any modifications in the conversion, it was accidental. I have some comments which will follow in a later message. I want to thank Javier for proposing this schema, and I want to use it to jumpstart work on supporting GNU/Linux in OVAL. I'll be discussing this with the OVAL Board, as arbiters of the official OVAL schema, but I expect to form a Linux working group, made up of Board members and others from the OVAL community interested and motivated to work on Linux issues. I've actually been meaning to send out mail regarding just that, but I've been caught up with other OVAL issues. I'm glad Javier's dragged it back towards the front burners. :) Below is the plain text version of the proposed schema. --Woj Matthew N. Wojcik woj@... OVAL Moderator http://oval.mitre.org/ ==================================== Proposed Schema for Debian GNU/Linux ==================================== Submitted by: Javier Fernandez-Sanguino <jfernandez@...> Version: 0 Status: DRAFT Debian_FileAttributes: File metadata ---------------------- FilePath -- Path to file. FileType -- Directory, named pipe, standard file, etc. Owner -- File owner Group -- File group Modified -- Time modified MD5 -- MD5 checksum SHA1 -- SHA1 checksum -- The following columns hold the individual permission bits SUID SGID STICKY UREAD UWRITE UEXEC GREAD GWRITE GEXEC OREAD OWRITE OEXEC Debian_Inetdconf: See manpage for inetd.conf(4) for colum definitions ----------------- ServiceName EndpointType Protocol WaitStatus ExecAsUser ServerProgram ServerArguments Debian_PSInfo: Output of /bin/ps -ecf. See ps(1). -------------- UserID PID ParentPID SchedulingClass Priority StartTime TTY ExecTime Command Debian_Dpkginfo: Output of dpkg -l "*". See man dpkg(8) ---------------- DPKGStatus -- Status DPKGName -- Name DPKGNVR -- Version-Revision DPKGVersion -- Version DPKGRevision -- Revision Debian_Shadow: /etc/shadow, See shadow(5) -------------- Username Password -- Encrypted password from /etc/passwd or /etc/shadow ChgLst -- last password change ChgAllow -- days until change allowed. ChgReq -- days before change required ExpWarn -- days warning for expiration ExpInact -- days before account inactive ExpDate -- date when account expires PswFlag -- reserved for future use Debian_Uname: uname -a command output. Examples in brackets. ------------- OSName -- first field or uname -s ['Linux'] NodeName -- second field or uname -n ['lab223.harris.com'] OSRelease -- third field or uname -r ['2.4.18-3' etc.] OSVersion -- fourth field or uname -v ['#1 Thu Apr 18 07:31:07 EDT 2002'] MachineClass -- fifth field or uname -m ['i586'] ProcessorType -- sixth field or uname -p ['unknown'] Debian_Version: /etc/debian_version --------------- OSVersion -- Content of version (either testing/unstable or X.Y) Debian_Users: /etc/passwd. See passwd(5). ------------- Username Password -- Encrypted password from /etc/passwd or /etc/shadow UID -- User id GID -- Primary group id GCOS -- AKA "real name" or "description" field HomeDir -- User's home directory LoginShell -- User's login shell Debian_Groups: /etc/group. See group(5). -------------- Groupname Password -- Encrypted password from /etc/group or /etc/gshadow GID -- Numerical group id User_list -- List of users belonging to the group Debian_InetListeningServers: Output of netstat -tuwlnpe (Note: lsof -ni ---------------------------- can be used but the field order changes) Protocol -- Communication protocol, first field ['TCP', 'UDP'..] LocalFullAddress -- Fourth field [address and port] LocalAddress -- Listening address, on the fourth field LocalPort -- Listening port, on the fourth field ForeignFullAddress -- Address of allowed clients, fifth field -- [address and port] ForeignAddress -- Allowed remote address on the fifth field ForeignPort -- Allowed remote port on the fifth field User -- User running the server, seventh field PID -- First part of field number nine, process ID -- running the service ProgramName -- Seconf part of field number nine, name of -- the process managing the connection |
||||||||||||||||||
|
Wojcik, Matthew N.
|
Some of my thoughts on the Debian schema as proposed. Some of these
also apply to the Red Hat draft on the OVAL Web site. Regarding inetd: Is xinetd a commonly used (or bundled) option under Debian, as it is under Red Hat? Parsing xinetd's much more rich and complex configuration files is clearly more of a challenge than the traditional inetd.conf. Any OVAL schema for these platforms will clearly need to take this into consideration. Regarding the Debian_Shadow and Debian_Users tables: This points out to me a mistake I may have made in writing the Solaris schema. I swept much of the information in /etc/shadow under the rug (and out of the schema) when I made the Solaris_Users table; having a "password" field with the "encrypted password from /etc/passwd or /etc/shadow" was probably a mistake. Perhaps we should commit to separate tables for these two files and let the query writer sort out which one to look at. This would also allow for a "mis-config" query that determined the system isn't using shadow passwords; currently impossible with the Solaris schema. Another important note: Keith Watson of Cerias (formerly at Sun) pointed out to me long ago that the schema notes imply (maybe I should say state!) that this information is gathered from these files, rather than by using the API calls that also pull data from other sources such as NIS(+). I kind of blew this off, since "OVAL's just a semantic specification and is not about implementation" (mocking self-quote, there), but it's an important point. Regarding Debian_Dpkginfo: I haven't used Debian packages, so forgive my ignorance. Are package version and revision numbers well-formed, or are they the typical jumble of an arbitrary number of dotted and maybe dashed numbers, with things like "p12" or "beta1" thrown in to give everybody headaches? See http://oval.mitre.org/community/board/archives/2002-07/msg00016.html for some comments on the OVAL Board discussion list last year about the difficulty in dealing with these kind of versions. Let me know if these concerns apply to Debian packages as well, and/or if anybody has any great ideas about how to deal with them. :) Regarding Debian_Version: Basically, the same kind of problem as above, though I assume that version numbers for the OS itself are at least somewhat under control. Also, Mark Cox advocated using rpm to query for the Red Hat release information (rpm -q redhat-release returning something like "redhat-release-7.1-1"). Would the information from /etc/debian_version show up in our Debian_Dpkginfo table? Should we just use that? I don't have anything against having a specific table for this file if it's necessary; it's just a question. Regarding Debian_InetdListeningServers: I fully support the need to determine if a service is truly running under our "Vulnerable Configuration" portion of OVAL queries. The fact that netstat information can be bound to process ID/name directly under Linux is a big advantage that we should take advantage of. Having said that, I just took a quick look at the output of netstat -tuwlnpe and netstat -tuwlnpea on my Red Hat box at home, and I'd need to investigate it a lot more before I was comfortable using it in a query. The problem once again is inetd / xinetd: I'm more confident that a vulnerable in.ftpd binary is going to be answering incoming client requests if I know that inetd or xinetd is running and configured to run that binary, than I am if I only see that (x)inetd is listening on port 21, ready to respond to a client request by launching *something*. Does that make sense? This may just be because I'm not familiar enough with my options under GNU/Linux. But I do think there's an important point there. Perhaps Javier or others could explain more about the concern with the current OVAL approach. Maybe give an example of a scenario where that approach would fail? I want to be clear that I'm not just trying to shoot down any proposed changes to the way OVAL has been going about detecting vulnerabilities. :) I'm just not sure I fully understand the issue. Many thanks to Javier for the work he has put in, and for getting work on OVAL support for GNU/Linux (re)started. --Woj Matthew N. Wojcik woj@... OVAL Moderator http://oval.mitre.org/ |
||||||||||||||||||
|
Javier Fernández-Sanguino-2
|
Matthew N. Wojcik wrote:
> Some of my thoughts on the Debian schema as proposed. Some of these > also apply to the Red Hat draft on the OVAL Web site. > > Regarding inetd: > > Is xinetd a commonly used (or bundled) option under Debian, as it is > under Red Hat? It is used and supported, but the default superdaemon is inetd. Admins can replace it but it's not as frequent as in RedHat (where it's the default). That might (probably) change in the future. > Parsing xinetd's much more rich and complex > configuration files is clearly more of a challenge than the > traditional inetd.conf. Any OVAL schema for these platforms will > clearly need to take this into consideration. Agreed. > Regarding the Debian_Shadow and Debian_Users tables: > > This points out to me a mistake I may have made in writing the Solaris > schema. I swept much of the information in /etc/shadow under the rug > (and out of the schema) when I made the Solaris_Users table; having a > "password" field with the "encrypted password from /etc/passwd or > /etc/shadow" was probably a mistake. Yes, you are right. Now that I look at it, the Debian_Users should have the encrypted password in /etc/passwd and the Debian_Shadow the password from /etc/shadow. (...) > > Another important note: Keith Watson of Cerias (formerly at Sun) > pointed out to me long ago that the schema notes imply (maybe I should > say state!) that this information is gathered from these files, rather > than by using the API calls that also pull data from other sources > such as NIS(+). I kind of blew this off, since "OVAL's just a > semantic specification and is not about implementation" (mocking > self-quote, there), but it's an important point. Why should it be retrieved from NIS(+)? I mean, if you are running an OVAL query interpreter you want to determine vulnerabilities in the local system being tested, not in remote servers. If you want to determine errors in your NIS(+) configuration you should go to the NIS server and test there. IMHO. Otherwise you might get inconsistencies in the way to test for a given vulnerability. Take CAN-1999-0501 up to CAN-1999-0519, for example. You can test this checking the password field for UNIX systems that use local authentication and when using NIS(+) since you can retrieve the remote map from the NIS server. But what if the system is using LDAP|Radius|SQL|etc. authentication? Do you have to take all of them into account in a single query? > Regarding Debian_Dpkginfo: > > I haven't used Debian packages, so forgive my ignorance. Are package > version and revision numbers well-formed, or are they the typical > jumble of an arbitrary number of dotted and maybe dashed numbers, with > things like "p12" or "beta1" thrown in to give everybody headaches? The correct way for Debian packages is: [epoch:]upstream_version[-debian_revision] Upstream_version can contain strings, as described in http://www.debian.org/doc/debian-policy/ch-versions.html but the conmparison method is very defined. > See > > http://oval.mitre.org/community/board/archives/2002-07/msg00016.html > > for some comments on the OVAL Board discussion list last year about > the difficulty in dealing with these kind of versions. Let me know if > these concerns apply to Debian packages as well, and/or if anybody has > any great ideas about how to deal with them. :) Well, if the issue is with doing comparisons in SQL I would suggest putting the information into a string and then create stored procedures (or similar programming stuff, depending on your database of choice) to compare versions and return the proper result. Of course, in the Debian case, your could also have these stored procedures to system calls. Dpkg, for example, can do 'dpkg --compare-versions X op Y' with different operator 'op' (<, >=, <=, >, = ....) Would that be a way to solve the issue? > Regarding Debian_Version: > > Basically, the same kind of problem as above, though I assume that > version numbers for the OS itself are at least somewhat under > control. Also, Mark Cox advocated using rpm to query for the Red Hat > release information (rpm -q redhat-release returning something like > "redhat-release-7.1-1"). Would the information from > /etc/debian_version show up in our Debian_Dpkginfo table? Should we > just use that? I don't have anything against having a specific table > for this file if it's necessary; it's just a question. I believe it does not make that much sense. And it's better to have them separated. A query might want to check the debian_version only, and it's much simpler to have it in a single place than for it to be mixed up with other package information IMO. > Regarding Debian_InetdListeningServers: > > I fully support the need to determine if a service is truly running > under our "Vulnerable Configuration" portion of OVAL queries. The > fact that netstat information can be bound to process ID/name directly > under Linux is a big advantage that we should take advantage of. Agreed, I did follow the discussions on this back in January (related to CAN-2002-0763) and I'm on the same opinion as you. One thing is having vulnerable software installed, and another one is being remotely exploitable because that software is running. > > Having said that, I just took a quick look at the output of > netstat -tuwlnpe and netstat -tuwlnpea on my Red Hat box at home, and > I'd need to investigate it a lot more before I was comfortable using > it in a query. The problem once again is inetd / xinetd: I'm more > confident that a vulnerable in.ftpd binary is going to be answering > incoming client requests if I know that inetd or xinetd is running and > configured to run that binary, than I am if I only see that (x)inetd is > listening on port 21, ready to respond to a client request by > launching *something*. Does that make sense? Yes. In the case of (x)inetd is the 'super-server' is the one in charge of opening the port so you will only see that process for all services handled by it (i.e. for all in 'grep -v ^# /etc/inetd.conf'). A query that wants to determine if your ftp server is vulnerable you have to a) check if the ftp server binary and related libraries are vulnerable b) check if inetd is configured to run it at a given port c) check if either the server itself is listening or inetd is listening on the port determined in b) The funny thing is that if inetd handles the service it's easier to detect if you have a vulnerable service/server than when the service is opening the port directly. That's because you have, not only to check the files and libraries of server installed but also of the server that is running. I.e. if the server was not restarted after a patch was applied to the binaries (or its libraries) it will still be vulnerable. And that's not that easy to check. > This may just be because I'm not familiar enough with my options under > GNU/Linux. But I do think there's an important point there. Perhaps > Javier or others could explain more about the concern with the current > OVAL approach. Maybe give an example of a scenario where that > approach would fail? Yes, given the scenario above (vendor patches applied but the server has not been restarted) the following queries will fail: OVAL94, OVAL56, OVAL15, OVAL11 and OVLA9. Note that the "AND NOT EXISTS Patch XXXX-XX" will return a false negative in this scenario. So, in all remote exploitable flaws you have to check, not only that the patch is applied (either by looking at the patches applied in Solaris or the versions installed in RedHat or Debian, or comparing MD5sums in either of them) but that the running service is using the same binary than the one is now on the system. > I want to be clear that I'm not just trying to shoot down any proposed > changes to the way OVAL has been going about detecting > vulnerabilities. :) I'm just not sure I fully understand the issue. > Brian Hatch talked about this (probably explaining it better than me) recently in "Linux Security: Tips, Tricks, and Hackery" mailing list, online available at http://www.hackinglinuxexposed.com/articles/20030409.html > Many thanks to Javier for the work he has put in, and for getting work > on OVAL support for GNU/Linux (re)started. You are most welcome, I should have sent this a long time ago. Regards Javier |
||||||||||||||||||
|
Jay Beale
|
In reply to this post by Wojcik, Matthew N.
In the wise words of Matthew N. Wojcik:
> Some of my thoughts on the Debian schema as proposed. Some of these > also apply to the Red Hat draft on the OVAL Web site. > > Regarding inetd: > > Is xinetd a commonly used (or bundled) option under Debian, as it is > under Red Hat? Parsing xinetd's much more rich and complex > configuration files is clearly more of a challenge than the > traditional inetd.conf. Any OVAL schema for these platforms will > clearly need to take this into consideration. Actually, it's not that much of a challenge. I've had to do it for the CIS scoring tool and it's pretty simple. You just run through each of the files in /etc/xinetd.d/, cataloguing the service line (port) and checking to see if there's a disable = yes line. Basically, a single xinetd file stores exactly the same info as a single inetd line... [ ... SNIP ... ] > Regarding Debian_InetdListeningServers: > > I fully support the need to determine if a service is truly running > under our "Vulnerable Configuration" portion of OVAL queries. The > fact that netstat information can be bound to process ID/name directly > under Linux is a big advantage that we should take advantage of. It's nice. When we're on Solaris, we might still get this straight out of lsof, as in: lsof -i tcp:22 > Having said that, I just took a quick look at the output of > netstat -tuwlnpe and netstat -tuwlnpea on my Red Hat box at home, and > I'd need to investigate it a lot more before I was comfortable using > it in a query. The problem once again is inetd / xinetd: I'm more > confident that a vulnerable in.ftpd binary is going to be answering > incoming client requests if I know that inetd or xinetd is running and > configured to run that binary, than I am if I only see that (x)inetd is > listening on port 21, ready to respond to a client request by > launching *something*. Does that make sense? Yes. But, really, parsing xinetd's files is still pretty simple. In the CIS scoring tool, we just pre-parse the inetd and xinetd files and put their data into the same data structure. xinetd doesn't really do much more than what inetd+TCP Wrappers did already... The additional features mostly help with logging. [ ... SNIP ... ] > Many thanks to Javier for the work he has put in, and for getting work > on OVAL support for GNU/Linux (re)started. Welcome, Javier! - Jay -- Linux / Unix Security: http://www.bastille-linux.org/jay |
||||||||||||||||||
|
Mark J Cox-2
|
In reply to this post by Wojcik, Matthew N.
> I want to thank Javier for proposing this schema, and I want to use it to
> jumpstart work on supporting GNU/Linux in OVAL. I've been watching the vulnerabilities over the last nine months to see how best Linux could be supported by OVAL, and I'll jump in with some comments and updates on the Red Hat scheme shortly. In the meantime I've made available the presentation that I gave at the original OVAL meeting back in June 2002 as the information is still relevant and useful for others getting involved from the Linux community: http://www.awe.com/mark/oval2002/ Thanks, Mark -- Mark J Cox / Red Hat Security Response Team |
||||||||||||||||||
|
Jay Beale
|
In the wise words of Mark J Cox:
> > I want to thank Javier for proposing this schema, and I want to use it to > > jumpstart work on supporting GNU/Linux in OVAL. > > I've been watching the vulnerabilities over the last nine months to see > how best Linux could be supported by OVAL, and I'll jump in with some > comments and updates on the Red Hat scheme shortly. In the meantime I've > made available the presentation that I gave at the original OVAL meeting > back in June 2002 as the information is still relevant and useful for > others getting involved from the Linux community: > > http://www.awe.com/mark/oval2002/ Thanks, Mark! I'm looking forward to getting into discussions with you and Javier especially on the Linux side. - Jay |
||||||||||||||||||
|
Javier Fernández-Sanguino-2
|
In reply to this post by Javier Fernández-Sanguino-2
Javier Fernandez-Sanguino wrote:
> Matthew N. Wojcik wrote: >> This may just be because I'm not familiar enough with my options >> under GNU/Linux. But I do think there's an important point there. >> Perhaps Javier or others could explain more about the concern with >> the current OVAL approach. Maybe give an example of a scenario >> where that approach would fail? > > > Yes, given the scenario above (vendor patches applied but the server > has not been restarted) the following queries will fail: OVAL94, > OVAL56, OVAL15, OVAL11 and OVLA9. Note that the "AND NOT EXISTS Patch > XXXX-XX" will return a false negative in this scenario. So, in all > remote exploitable flaws you have to check, not only that the patch > is applied (either by looking at the patches applied in Solaris or > the versions installed in RedHat or Debian, or comparing MD5sums in > either of them) but that the running service is using the same binary > than the one is now on the system. > >> I want to be clear that I'm not just trying to shoot down any >> proposed changes to the way OVAL has been going about detecting >> vulnerabilities. :) I'm just not sure I fully understand the >> issue. >> > > Brian Hatch talked about this (probably explaining it better than me) > recently in "Linux Security: Tips, Tricks, and Hackery" mailing > list, online available at > http://www.hackinglinuxexposed.com/articles/20030409.html Just to demonstrate this, and after some work while on vacation I came out with this to automatically test this case: (sorry for the long link) http://savannah.nongnu.org/cgi-bin/viewcvs/tiger/tiger/scripts/check_finddeleted?rev=1.1&content-type=text/vnd.viewcvs-markup Just in case someone wants to see how this should be tested. This script (one of the many available in the Tiger security tool) will determine if you are running a process which is using deleted files. This might be because of: a) an intruder removing the files after executing them to cover his tracks b) a patch being applied that updates libraries but the servers which use those libraries have not been restarted yet. Best regards Javi |
||||||||||||||||||
|
Javier Fernández-Sanguino-2
|
In reply to this post by Jay Beale
Jay Beale wrote:
> In the wise words of Matthew N. Wojcik: > >>Regarding Debian_InetdListeningServers: >> >>I fully support the need to determine if a service is truly running >>under our "Vulnerable Configuration" portion of OVAL queries. The >>fact that netstat information can be bound to process ID/name directly >>under Linux is a big advantage that we should take advantage of. > > > It's nice. When we're on Solaris, we might still get this straight > out of lsof, as in: > > lsof -i tcp:22 Most Solaris installations I see don't come with lsof, that's when you need to start using 'pfiles' [1] Regards Javi [1] A proof of concept on how to test for listening services in Solaris w/o using LSOF is implement at http://savannah.nongnu.org/cgi-bin/viewcvs/tiger/tiger/systems/SunOS/5/5.8/check_listeningprocs?rev=1.1&content-type=text/vnd.viewcvs-markup |
||||||||||||||||||
| Free Forum Powered by Nabble | Forum Help |