Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 750017
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 14, 20262026-05-14T14:30:07+00:00 2026-05-14T14:30:07+00:00

I was going through an article today when it mentioned the following: We’ve found

  • 0

I was going through an article today when it mentioned the following:

“We’ve found many errors over the
years. One of the absolute best was
the following in the X Window System:

     if(getuid() != 0 && geteuid == 0) {
       ErrorF("Only root");
       exit(1);
     }

It allowed any local user to get root
access. (The tautological check
geteuid == 0 was intended to be
geteuid() == 0. In its current form,
it compress the address of geteuid to
0; given that the function exists, its
address is never 0).”

The article explained what was wrong with the code but I would like to know what it means to say that “It allowed any local user to get root access”. I am not an expert in C but can someone give me an exact context in which this exploit would work? Specifically, what I mean is, lets say I am the local user, how would I get root access if we assume this code to be present somewhere?

For anyone interested in reading the full article, here’s the link:

A Few Billion Lines of Code Later: Using Static Analysis to Find Bugs in Real World

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-14T14:30:07+00:00Added an answer on May 14, 2026 at 2:30 pm

    The article means that the code after the if, which was intended to be executed only if it was verified that the user was root, could actually be executed by anyone. To take advantage of it, you look for the branch in the code in which the test is used to check the identity of the user (which the article responsibly does not provide: you have to work a little) and you arrange for it to be executed.

    “allowed to get root access” is an ellipsis to describe what happens after the if in the original code. It does not make particular sense in relation with the test because it describe what happens after it.

    In other words, the test itself does not make you root. The code after it makes you root. Also, bear in mind that the X server often has to be installed with root owner and setuid bit set, which is the reason why flawed logic in its code is dangerous.

    This is not a question about C. It is a question about the Unix security model, which is awfully binary (especially in the older implementations): you have to be root to do anything, so quantities of programs have root owner and setuid bit (caricaturing a little bit).

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I'm thinking about starting a new project using EF 4 and going through some
After going through a lot of articles on IDisposable , I got confused about
I'm going through the Sharded Counters example in Java: http://code.google.com/appengine/articles/sharding_counters.html I have a question
Is there any good article that gets me started with Google Visualization API which
Apple responded to one of my bug reports suggesting I try to reproduce the
On my rails app I have implemented AuthLogic and CanCan. However when trying to
I'm trying to do an XMLHttpRequest from a local file (file://) using JQuery.ajax to
New to rails and I have what I think is a basic question. In
I have a winform app that uses LinqToSql as it's DAL. There is a
I'm working on a multi-site CMS that has a notion of cross-publication among sites.

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.