Thursday, April 14, 2005

A unix teaser

I was no God.
I told her my password.
She ran to a unix terminal.
She logged in to my account.
Using 'passwd' she changed my password to whatever she wanted.
she checked if the password was changed. It really was.
When she came back, she fainted when she saw me using different password.

How could I do that?

TIP: It was a race condition

9 comments:

SG said...

I said "I was no god."

SG said...

What does your second point mean?

SG said...

Well..I have no control over 'passwd'.
Now?

SG said...

Okay. You dont have control over the environment too. So you cant change PATH or trick her to execute a trojan.

HINT AGAIN: It is a race condition.

#alpha0

SG said...

Well, it is little tricky.
As soon as she left to change my password. I typed 'passwd' and fed old password to it and let it waiting for new password.
When she came back and told me that she had changed my password. I supplied new password to the command waiting for new password..And now I have my new password.

Got it!
I used to use this trick in college.
My admin used to discourage 'lynx' from shell and he used to kill lynx and change the password. So, I always kept two shells open in one I used to browse using lynx and in other I kept 'passwd' waiting for new password. So, when my lynx is killed I new that the password has been changed by admin. I supply password to my command waiting for new password.
And live happily after till I again browse using lynx.:)
#Alph0

SG said...

The Title says "A unix teaser":)
But we cant say it a cheap trick.

If you were supposed to write 'password', how would you avoid this?

--Alpha0

SG said...

I mean 'passwd'.

SG said...

Yeah. If he could have killed my all processes and then change the password, I was gone.
Infact he was a dumb ass-0-.

If you are supposed to write 'passwd' how to avoid this kind of problem?

--Sandeep

SG said...

I would suggest that the application should take old password and new password and then check and update it.