Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

ROP setRegisters #1019

Closed
zachriggle opened this issue Sep 1, 2017 · 1 comment · Fixed by #1044
Closed

ROP setRegisters #1019

zachriggle opened this issue Sep 1, 2017 · 1 comment · Fixed by #1044
Assignees
Milestone

Comments

@zachriggle
Copy link
Member

The current issue with setRegisters is that it requires basic gadgets a la pop rdi; ret.

If we need to set rdi and rsi and we have the following gadget, it will fail:

pop rsi; pop rdi; ret

We can solve this in two ways.

Dirty matching

Just use whatever matches we can get away with. This will bloat our ROP stack.

Set cover problem

This is ultimately the Set Cover Problem. Given a set of registers R which we wish to modify, and a collection S of m sets each containing some of the registers, we want to optimize for total stack space used.

This is slightly different from the Set Cover Problem, because our desired set R is not all possible values in the union of all sets in S, but it is a subset. Separately, we want to optimize not for the cardinality of the selected sets, but the total stack space used (since all gadgets add a ret and some gadgets even have add esp).

@zachriggle zachriggle self-assigned this Sep 1, 2017
@zachriggle
Copy link
Member Author

We should also cache the results of this operation, since it may be expensive.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging a pull request may close this issue.

1 participant