I think that this might be an typo or at least it has plausible deniability. I have changed my coding style to always put constant on left side just to avoid such an error (such typo gave me a few days of debugging multithreaded code and I have just said "Never again!!" :D)
The Linux Backdoor Attempt of 2003 (2013)
11–20 of 144 posts
Re: The Linux Backdoor Attempt of 2003 (2013)
#12Which brings up the question: how many more root-based backdoors are there now in the source code?
Re: The Linux Backdoor Attempt of 2003 (2013)
#13Something as important as "uid" should be "const".
But then I have used exactly this pattern, and it looks something like:
struct protected_stuff { int userid; ... };
void set_userid(const struct protected_stuff prot, int newuserid) { struct protected_stuff backdoor = (struct protected_stuff *)prot; backdoor->userid = newuserid; }
and then the compiler complains if you go fiddling with userid outside this function where you deliberately opened a backdoor to write to it. (and you can wrap pragmas around that function to turn off warnings).
Re: The Linux Backdoor Attempt of 2003 (2013)
#14I think that this might be an typo or at least it has plausible deniability. I have changed my coding style to always put constant on left side just to avoid such an error (such typo gave me a few days of debugging multithreaded code and I have just said "Never again!!" :D)
Re: The Linux Backdoor Attempt of 2003 (2013)
#15Re: The Linux Backdoor Attempt of 2003 (2013)
#16So why did this attacker choose such an obvious 'typo' rather than a subtle flaw in a large patch set?
Re: The Linux Backdoor Attempt of 2003 (2013)
#17I admit that I read the code and completely overlooked the single equals sign. Makes me wonder why it would be so easy to change the userid. Shouldn’t there be some safeguards in place to stop the userid from being updated from unsafe places.
Re: The Linux Backdoor Attempt of 2003 (2013)
#18Something as important as "uid" should be "const".
I mean... my first reading of that is "what a dumb idea, the reason it isn't const is that there are legit reasons to switch userid". But then I have used exactly this pattern, and it looks something like: struct protected_stuff { int userid; ... }; void set_userid(const struct protected_stuff prot, int newuserid) { struct protected_stuff backdoor = (struct protected_stuff *)prot; backdoor->userid = newuserid; } and…
Re: The Linux Backdoor Attempt of 2003 (2013)
#19Earlier quoted context omitted.
I mean... my first reading of that is "what a dumb idea, the reason it isn't const is that there are legit reasons to switch userid". But then I have used exactly this pattern, and it looks something like: struct protected_stuff { int userid; ... }; void set_userid(const struct protected_stuff prot, int newuserid) { struct protected_stuff backdoor = (struct protected_stuff *)prot; backdoor->userid = newuserid; } and…
Compilers will produce slower code for this construction.
Re: The Linux Backdoor Attempt of 2003 (2013)
#20I think code like this shouldn't even compile like in other languages >Operator '&&' cannot be applied to operands of type 'bool' and 'int'