Top Banner
Race Condition Yajin Zhou (http://yajin.org ) Zhejiang University Credits: SEEDLab http://www.cis.syr.edu/~wedu/seed/
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

Oct 11, 2020

Download

Documents

dariahiddleston
Welcome message from author
This document is posted to help you gain knowledge. Please leave a comment to let me know what you think about it! Share it to your friends and learn new things together.
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