race condition - yajin · a vulnerable set-uid program • access -> check real user id •...

14
Race Condition Yajin Zhou (http://yajin.org ) Zhejiang University Credits: SEEDLab http://www.cis.syr.edu/~wedu/seed/

Upload: others

Post on 11-Oct-2020

0 views

Category:

Documents


0 download

TRANSCRIPT

Page 1: Race Condition - Yajin · A vulnerable Set-UID program • Access -> check real user id • Open-> check effective user id • That’sthe reason why we need access before open

Race Condition

Yajin Zhou (http://yajin.org)

Zhejiang University

Credits: SEEDLab

http://www.cis.syr.edu/~wedu/seed/

Page 2: Race Condition - Yajin · A vulnerable Set-UID program • Access -> check real user id • Open-> check effective user id • That’sthe reason why we need access before open

A vulnerable Set-UID program

Page 3: Race Condition - Yajin · A vulnerable Set-UID program • Access -> check real user id • Open-> check effective user id • That’sthe reason why we need access before open

A vulnerable Set-UID program

• Access -> check real user id

• Open-> check effective user id

• That’s the reason why we need access before open

Page 4: Race Condition - Yajin · A vulnerable Set-UID program • Access -> check real user id • Open-> check effective user id • That’sthe reason why we need access before open

How to attack

Page 5: Race Condition - Yajin · A vulnerable Set-UID program • Access -> check real user id • Open-> check effective user id • That’sthe reason why we need access before open

Experiment

Page 6: Race Condition - Yajin · A vulnerable Set-UID program • Access -> check real user id • Open-> check effective user id • That’sthe reason why we need access before open

Experiment

Page 7: Race Condition - Yajin · A vulnerable Set-UID program • Access -> check real user id • Open-> check effective user id • That’sthe reason why we need access before open

Experiment

• X->password is stored /etc/shadow

• No x -> password is in /etc/passwd

Page 8: Race Condition - Yajin · A vulnerable Set-UID program • Access -> check real user id • Open-> check effective user id • That’sthe reason why we need access before open

Experiment

Attack_process.c

Page 9: Race Condition - Yajin · A vulnerable Set-UID program • Access -> check real user id • Open-> check effective user id • That’sthe reason why we need access before open

Experiment

Target_process.sh

Page 10: Race Condition - Yajin · A vulnerable Set-UID program • Access -> check real user id • Open-> check effective user id • That’sthe reason why we need access before open

Experiment

Target_process.sh

Page 11: Race Condition - Yajin · A vulnerable Set-UID program • Access -> check real user id • Open-> check effective user id • That’sthe reason why we need access before open

Experiment

Page 12: Race Condition - Yajin · A vulnerable Set-UID program • Access -> check real user id • Open-> check effective user id • That’sthe reason why we need access before open

Experiment

Page 13: Race Condition - Yajin · A vulnerable Set-UID program • Access -> check real user id • Open-> check effective user id • That’sthe reason why we need access before open

Defense

• Atomic operation

• If we can have an option to tell open to use real UID (instead of

effective UID)

• Sticky protection

Page 14: Race Condition - Yajin · A vulnerable Set-UID program • Access -> check real user id • Open-> check effective user id • That’sthe reason why we need access before open

Defense

• Least privilege