LinuxSecurity.com
Share your story
The central voice for Linux and Open Source security news
Home News Topics Advisories HOWTOs Features Newsletters About Register

Welcome!
Sign up!
EnGarde Community
Login
Polls
What is the most important Linux security technology?
 
Advisories
Community
Linux Events
Linux User Groups
Link to Us
Security Center
Book Reviews
Security Dictionary
Security Tips
SELinux
White Papers
Featured Blogs
All About Linux
DanWalsh LiveJournal
Securitydistro
Latest Newsletters
Linux Advisory Watch: October 24th, 2014
Linux Security Week: October 20th, 2014
Subscribe
LinuxSecurity Newsletters
E-mail:
Choose Lists:
About our Newsletters
RSS Feeds
Get the LinuxSecurity news you want faster with RSS
Powered By

  
NetBSD: System privilege escalation vulnerability Print E-mail
User Rating:      How can I rate this item?
Posted by LinuxSecurity.com Team   
NetBSD Missing validation of user-supplied arguments to a system call canallow user applications on the sh3 platform to execute code withsupervisor privileges, bypassing normal system protections.

                 NetBSD Security Advisory 2001-008
                 =================================

Topic:          Processes can gain "Supervisor" privileges on sh3.
Version:        All versions of NetBSD, on the sh3 platform only.
Severity:       Local users may execute code with supervisor privileges.
Fixed:          NetBSD-current:    May 16, 2001
                NetBSD-1.5 branch: May 27, 2001

Abstract
========

Missing validation of user-supplied arguments to a system call can
allow user applications on the sh3 platform to execute code with
supervisor privileges, bypassing normal system protections.

This problem is only present on the sh3 platform, which includes the
dreamcast, evbsh3, hpcsh and mmeye ports.


Technical Details
=================

The Hitachi Super-H architecture includes the Status Register, a
processor register which provides status information such as the
true/false condition bit, and which also controls properties among
which is the processor mode (either user mode or privileged mode).
The only component of NetBSD executing in privileged mode is the
kernel; user processes are restricted to user mode and thus cannot
execute privileged processor instructions or access related resources.

As a part of the protection model, the contents of the Status Register
can be modified only when executing in privileged mode.

While reviewing code in NetBSD, it was discovered that the NetBSD
"sigreturn" system call did not do validation of user-supplied Status
Register contents; it was also discovered that the
"process_write_regs" kernel routine, which is used by the procfs and
ptrace(2) facilities, did not do appropriate validation of
user-supplied Status Register contents; in short, it's possible for a
user process to construct and pass an execution context which makes it
resume in privileged mode.


Solutions and Workarounds
=========================

Systems running NetBSD/evbsh3, NetBSD/dreamcast, NetBSD/hpcsh or
NetBSD/mmeye are vulnerable.  Although the NetBSD Project has not
distributed binary releases for these ports yet, binary snapshots
of development versions are known to be in use.

Systems running NetBSD-current dated from before May 16, 2001 should
be upgraded to NetBSD-current dated May 16, 2001 or later.

Systems running NetBSD-release-1-5 dated from before May 27, 2001
should be upgraded to NetBSD-release-1-5 dated May 27, 2001 or later.

The following patches to /sys/arch/sh3/include/psl.h,
/sys/arch/sh3/sh3/compat_13_machdep.c and /sys/arch/sh3/sh3/sh3_machdep.c
should be applied before building a new kernel.  This patch can
be applied (with offset differences) to NetBSD-1.5 or NetBSD-current
kernel sources using the patch(1) command.

Index: include/psl.h
===================================================================
RCS file: /cvsroot/syssrc/sys/arch/sh3/include/psl.h,v
retrieving revision 1.1
retrieving revision 1.2
diff -u -r1.1 -r1.2
--- include/psl.h       1999/09/13 10:31:21     1.1
+++ include/psl.h       2001/05/16 12:42:38     1.2
@@ -57,8 +57,8 @@
 #define        PSL_MBO         0x00000000      /* must be one bits */
 #define        PSL_MBZ         0x8ffffc0c      /* must be zero bits */

-#define PSL_USERSET    0
-#define PSL_USERSTATIC    (PSL_BL|PSL_RB|PSL_MD|PSL_IMASK)
+#define PSL_USERSET    0
+#define PSL_USERSTATIC (PSL_BL|PSL_RB|PSL_MD|PSL_IMASK|PSL_MBO|PSL_MBZ)

 #ifdef _KERNEL
 #include 
Index: sh3/compat_13_machdep.c
===================================================================
RCS file: /cvsroot/syssrc/sys/arch/sh3/sh3/compat_13_machdep.c,v
retrieving revision 1.2
retrieving revision 1.3
diff -u -r1.2 -r1.3
--- sh3/compat_13_machdep.c     2000/12/22 22:58:55     1.2
+++ sh3/compat_13_machdep.c     2001/05/16 12:42:38     1.3
@@ -71,16 +71,9 @@
        /* Restore register context. */
        tf = p->p_md.md_regs;

-       /*
-        * Check for security violations.  If we're returning to
-        * protected mode, the CPU will validate the segment registers
-        * automatically and generate a trap on violations.  We handle
-        * the trap, rather than doing all of the checking here.
-        */
-#ifdef TODO
+       /* Check for security violations.  */
        if (((context.sc_ssr ^ tf->tf_ssr) & PSL_USERSTATIC) != 0)
                return (EINVAL);
-#endif

        tf->tf_ssr = context.sc_ssr;

Index: sh3/sh3_machdep.c
===================================================================
RCS file: /cvsroot/syssrc/sys/arch/sh3/sh3/sh3_machdep.c,v
retrieving revision 1.12
retrieving revision 1.13
diff -u -r1.12 -r1.13
--- sh3/sh3_machdep.c   2001/04/24 04:31:09     1.12
+++ sh3/sh3_machdep.c   2001/05/16 12:42:38     1.13
@@ -350,21 +350,13 @@

        /* Restore signal context. */
        tf = p->p_md.md_regs;
-       {
-               /*
-                * Check for security violations.  If we're returning to
-                * protected mode, the CPU will validate the segment registers
-                * automatically and generate a trap on violations.  We handle
-                * the trap, rather than doing all of the checking here.
-                */
-#ifdef TODO
-         if (((context.sc_ssr ^ tf->tf_ssr) & PSL_USERSTATIC) != 0) {
-           return (EINVAL);
-         }
-#endif

-         tf->tf_ssr = context.sc_ssr;
-       }
+       /* Check for security violations. */
+       if (((context.sc_ssr ^ tf->tf_ssr) & PSL_USERSTATIC) != 0)
+               return (EINVAL);
+
+       tf->tf_ssr = context.sc_ssr;
+
        tf->tf_r0 = context.sc_r0;
        tf->tf_r1 = context.sc_r1;
        tf->tf_r2 = context.sc_r2;


Thanks To
=========

Klaus Klein for detecting and resolving this problem.


Revision History
================

        2001-05-29      Initial Release

More Information
================

An up-to-date PGP signed copy of this release will be maintained at
   ftp://ftp.netbsd.org/pub/NetBSD/security/advisories/NetBSD-SA2001-008.txt.asc

Information about NetBSD and NetBSD security can be found at 
http://www.NetBSD.ORG/ and  http://www.NetBSD.ORG/Security/.


Copyright 2001, The NetBSD Foundation, Inc.  All Rights Reserved.

$NetBSD: NetBSD-SA2001-008.txt,v 1.6 2001/05/29 05:58:42 lukem Exp $



 
< Prev   Next >
    
Partner

 

Latest Features
Peter Smith Releases Linux Network Security Online
Securing a Linux Web Server
Password guessing with Medusa 2.0
Password guessing as an attack vector
Squid and Digest Authentication
Squid and Basic Authentication
Demystifying the Chinese Hacking Industry: Earning 6 Million a Night
Free Online security course (LearnSIA) - A Call for Help
What You Need to Know About Linux Rootkits
Review: A Practical Guide to Fedora and Red Hat Enterprise Linux - Fifth Edition
Yesterday's Edition
Pro-Privacy Senator Wyden on Fighting the NSA From Inside the System
NIST to hypervisor admins: secure your systems
Quick PHP patch beats slow research reveal
Partner Sponsor

Community | HOWTOs | Blogs | Features | Book Reviews | Networking
 Security Projects |  Latest News |  Newsletters |  SELinux |  Privacy |  Home
 Hardening |   About Us |   Advertise |   Legal Notice |   RSS |   Guardian Digital
(c)Copyright 2014 Guardian Digital, Inc. All rights reserved.