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

Potential invalid MEMREF translation, this could be used for bad. #53

Open
Machiry opened this issue May 31, 2016 · 0 comments
Open

Potential invalid MEMREF translation, this could be used for bad. #53

Machiry opened this issue May 31, 2016 · 0 comments

Comments

@Machiry
Copy link

Machiry commented May 31, 2016

In https://github.com/OP-TEE/optee_linuxdriver/blob/master/core/tee_session.c#L600, param->c_shm[idx] is copied from user.

In https://github.com/OP-TEE/optee_linuxdriver/blob/master/core/tee_session.c#L628, where we call tee_shm_get:
tee_shm_get(ctx, &param->c_shm[idx], size, offset)

Then in function: tee_shm_get (https://github.com/OP-TEE/optee_linuxdriver/blob/master/core/tee_shm.c#L716) , Here, c_shm is copied from user (i.e param->c_shm[idx]).

Then the check in 741, i.e:
if (c_shm->flags & TEEC_MEM_KAPI) {
//Now, kc_shm is User Controlled.
struct tee_shm *kc_shm = (struct tee_shm *)c_shm->d.ptr;

    if (!kc_shm) {
        dev_err(_DEV(tee), "kapi fd null\n");
        ret = -EINVAL;
        goto err;
    }
           //  Here shm->paddr is controlled by user.
    shm->paddr = kc_shm->paddr;

This could be exploited to pass arbitrary physical address to Trustlets.

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

No branches or pull requests

1 participant