lists.openwall.net   lists  /  announce  owl-users  owl-dev  john-users  john-dev  passwdqc-users  yescrypt  popa3d-users  /  oss-security  kernel-hardening  musl  sabotage  tlsify  passwords  /  crypt-dev  xvendor  /  Bugtraq  Full-Disclosure  linux-kernel  linux-netdev  linux-ext4  linux-hardening  linux-cve-announce  PHC 
Open Source and information security mailing list archives
 
Hash Suite: Windows password security audit tool. GUI, reports in PDF.
[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Date:   Tue, 30 Jan 2018 13:03:20 -0800
From:   Tim Chen <tim.c.chen@...ux.intel.com>
To:     Borislav Petkov <bp@...en8.de>, David Woodhouse <dwmw@...zon.co.uk>
Cc:     arjan@...ux.intel.com, tglx@...utronix.de, karahmed@...zon.de,
        x86@...nel.org, linux-kernel@...r.kernel.org, peterz@...radead.org,
        pbonzini@...hat.com, ak@...ux.intel.com,
        torvalds@...ux-foundation.org, gregkh@...ux-foundation.org,
        mingo@...nel.org, luto@...nel.org, linux@...inikbrodowski.net
Subject: Re: [PATCH] x86/speculation: Use Indirect Branch Prediction Barrier
 in context switch

On 01/30/2018 12:38 PM, Borislav Petkov wrote:
> On Mon, Jan 29, 2018 at 10:04:47PM +0000, David Woodhouse wrote:
>> +		if (tsk && tsk->mm &&
>> +		    tsk->mm->context.ctx_id != last_ctx_id &&
>> +		    get_dumpable(tsk->mm) != SUID_DUMP_USER)
>> +			indirect_branch_prediction_barrier();
> 
> Ok, so while staring at this, someone just came up with the following
> sequence:
> 
> 1. Malicious process runs with UID=A, does BTB poisoning
> 2. Sensitive process (e.g. gpg) starts also with UID=A, no IBPB flush occurs since task is initially dumpable
> 3. gpg now does prctl(PR_SET_DUMPABLE, ...) to clear the dumpable flag
> 4. gpg now does sensitive stuff that it thinks is protected
> 5. gpg does indirect branches that shouldn't be influenced by the malicious process
> 
> Now, if you switch between steps 3. and 4., you're good because gpg
> became non-dumpable. But if you *don't* switch, the bad BTB entries are
> still there.

The attacker has to guarantee itself to run right before victim. And
the window of attack is very small, as only the first context switch to victim
may be vulnerable. The victim will be immune on the next switch.  
For timing attack, the attacker needs to scan one bit at a time.  
So probably the attacker could glean 1 bit of information
on the switch back to the attacker and then the attacker could not scan
further.  So it doesn't seem to be very practical attack if the victim
has set itself to be non-dumpable.

Tim

> 
> So, *actually*, we need to flush IBPB in set_dumpable() too, when we
> clear SUID_DUMP_USER.
> 
> Or, are we missing something obvious here and that is not needed because
> of reasons I haven't thought about?
> 
> I know, gpg doesn't do prctl() but disables core dumping with
> setrlimit() but there might be other processes who do that...
> 
> Thx.
> 

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ