Showing posts sorted by date for query hardening-media-stack. Sort by relevance Show all posts
Showing posts sorted by date for query hardening-media-stack. Sort by relevance Show all posts

Friday, October 26, 2018

Double Stuffed Safety Inwards Android Oreo

Double Stuffed Safety Inwards Android Oreo

Posted past times Gian G Spicuzza, Android Security team

Android Oreo is stuffed total of safety enhancements. Over the past times few months, we've covered how we've improved the safety of the Android platform together with its applications: from making it safer to larn apps, dropping insecure network protocols, providing to a greater extent than user command over identifiers, hardening the kernel, making Android easier to update, all the mode to doubling the Android Security Rewards payouts. Now that Oreo is out the door, let's conduct maintain a await at all the goodness inside.

Expanding back upwards for hardware security

Android already supports Verified Boot, which is designed to foreclose devices from booting upwards alongside software that has been tampered with. In Android Oreo, nosotros added a reference implementation for Verified Boot running alongside Project Treble, called Android Verified Boot 2.0 (AVB). AVB has a brace of cool features to brand updates easier together with to a greater extent than secure, such equally a mutual footer format together with rollback protection. Rollback protection is designed to foreclose a device to kick if downgraded to an older OS version, which could survive vulnerable to an exploit. To exercise this, the devices salvage the OS version using either special hardware or past times having the Trusted Execution Environment (TEE) sign the data. Pixel 2 together with Pixel 2 XL come upwards alongside this protection together with nosotros recommend all device manufacturers add together this characteristic to their novel devices.

Oreo also includes the novel OEM Lock Hardware Abstraction Layer (HAL) that gives device manufacturers to a greater extent than flexibility for how they protect whether a device is locked, unlocked, or unlockable. For example, the novel Pixel phones work this HAL to travel past times commands to the bootloader. The bootloader analyzes these commands the side past times side fourth dimension the device boots together with determines if changes to the locks, which are securely stored inward Replay Protected Memory Block (RPMB), should happen. If your device is stolen, these safeguards are designed to foreclose your device from beingness reset together with to perish along your information secure. This novel HAL fifty-fifty supports moving the lock dry soil to dedicated hardware.

Speaking of hardware, we've invested back upwards inward tamper-resistant hardware, such equally the security module works life inward every Pixel 2 together with Pixel 2 XL. This physical chip prevents many software together with hardware attacks together with is also resistant to physical penetration attacks. The safety module prevents deriving the encryption fundamental without the device's passcode together with limits the charge per unit of measurement of unlock attempts, which makes many attacks infeasible due to fourth dimension restrictions.

While the novel Pixel devices conduct maintain the special safety module, all novel GMS devices transportation alongside Android Oreo are required to implement key attestation. This provides a machinery for strongly attesting IDs such equally hardware identifiers.

We added novel features for enterprise-managed devices equally well. In piece of work profiles, encryption keys are straightaway ejected from RAM when the profile is off or when your company's admin remotely locks the profile. This helps secure enterprise information at rest.

Platform hardening together with procedure isolation

As constituent of Project Treble, the Android framework was re-architected to brand updates easier together with less costly for device manufacturers. This separation of platform together with vendor-code was also designed to improve security. Following the principle of to the lowest degree privilege, these HALs run inward their own sandbox together with solely conduct maintain access to the drivers together with permissions that are absolutely necessary.

Continuing alongside the media stack hardening inward Android Nougat, nearly direct hardware access has been removed from the media frameworks inward Oreo resulting inward improve isolation. Furthermore, we've enabled Control Flow Integrity (CFI) across all media components. Most vulnerabilities today are exploited past times subverting the normal command catamenia of an application, instead changing them to perform arbitrary malicious activities alongside all the privileges of the exploited application. CFI is a robust safety machinery that disallows arbitrary changes to the master copy command catamenia graph of a compiled binary, making it significantly harder to perform such attacks.

In add-on to these architecture changes together with CFI, Android Oreo comes alongside a feast of other tasty platform safety enhancements:

  • Seccomp filtering: makes some unused syscalls unavailable to apps together with so that they can't survive exploited past times potentially harmful apps.
  • Hardened usercopy: Influenza A virus subtype H5N1 recent survey of safety bugs on Android revealed that invalid or missing bounds checking was seen inward unopen to 45% of substance vulnerabilities. We've backported a bounds checking characteristic to Android kernels 3.18 together with above, which makes exploitation harder piece also helping developers location issues together with laid upwards bugs inward their code.
  • Privileged Access Never (PAN) emulation: Also backported to 3.18 kernels together with above, this characteristic prohibits the substance from accessing user infinite direct together with ensures developers utilize the hardened functions to access user space.
  • Kernel Address Space Layout Randomization (KASLR): Although Android has supported userspace Address Space Layout Randomization (ASLR) for years, we've backported KASLR to assistance mitigate vulnerabilities on Android kernels 4.4 together with newer. KASLR works past times randomizing the location where substance code is loaded on each boot, making code reuse attacks probabilistic together with thence to a greater extent than hard to deport out, particularly remotely.

App safety together with device identifier changes

Android Instant Apps run inward a restricted sandbox which limits permissions together with capabilities such equally reading the on-device app listing or transmitting cleartext traffic. Although introduced during the Android Oreo release, Instant Apps supports devices running Android Lollipop together with later.

In society to grip untrusted content to a greater extent than safely, we've isolated WebView past times splitting the rendering engine into a form procedure together with running it within an isolated sandbox that restricts its resources. WebView also supports Safe Browsing to protect against potentially unsafe sites.

Lastly, we've made significant changes to device identifiers to give users to a greater extent than control, including:

  • Moving the static Android ID together with Widevine values to an app-specific value, which helps boundary the work of device-scoped non-resettable IDs.
  • In accordance alongside IETF RFC 7844 anonymity profile, net.hostname is straightaway empty together with the DHCP customer no longer sends a hostname.
  • For apps that postulate a device ID, we've built a Build.getSerial() API together with protected it behind a permission.
  • Alongside safety researchers1, nosotros designed a robust MAC address randomization for Wi-Fi scan traffic inward diverse chipsets firmware.

Android Oreo brings inward all of these improvements, together with many more. As always, nosotros appreciate feedback together with welcome suggestions for how nosotros tin improve Android. Contact us at security@android.com.

_____________________________________________________________________

1: Glenn Wilkinson together with squad at Sensepost, UK, Célestin Matte, Mathieu Cunche: University of Lyon, INSA-Lyon, CITI Lab, Inria Privatics, Mathy Vanhoef, KU Leuven

Wednesday, October 10, 2018

Compiler-Based Safety Mitigations Inward Android P

Posted yesteryear Ivan Lozano, Information Security Engineer

Android's switch to LLVM/Clang every bit the default platform compiler inwards Android 7.0 opened upward to a greater extent than possibilities for improving our defense-in-depth safety posture. In the yesteryear couplet of releases, we've rolled out additional compiler-based mitigations to brand bugs harder to exploit too preclude for sure types of bugs from becoming vulnerabilities. In Android P, we're expanding our existing compiler mitigations, which musical instrument runtime operations to neglect safely when undefined demeanour occurs. This post service describes the novel construct arrangement back upward for Control Flow Integrity too Integer Overflow Sanitization.

Control Flow Integrity

Influenza A virus subtype H5N1 cardinal footstep inwards modern exploit chains is for an aggressor to gain command of a program's command period of time yesteryear corrupting business office pointers or supply addresses. This opens the door to code-reuse attacks where an aggressor executes arbitrary portions of existing computer programme code to attain their goals, such every bit counterfeit-object-oriented too return-oriented programming. Control Flow Integrity (CFI) describes a ready of mitigation technologies that confine a program's command period of time to a telephone outcry upward graph of valid targets determined at compile-time.

While nosotros outset supported LLVM's CFI implementation inwards select components inwards Android O, we're greatly expanding that back upward inwards P. This implementation focuses on preventing command period of time manipulation via indirect branches, such every bit business office pointers too virtual functions—the 'forward-edges' of a telephone outcry upward graph. Valid branch targets are defined every bit business office entry points for functions amongst the expected business office signature, which drastically reduces the ready of allowable destinations an aggressor tin call. Indirect branches are instrumented to notice runtime violations of the statically determined ready of allowable targets. If a violation is detected because a branch points to an unexpected target, hence the procedure safely aborts.

Clang every bit the default platform compiler inwards Android   Compiler-based safety mitigations inwards Android P

Figure 1. Assembly-level comparing of a virtual business office telephone outcry upward amongst too without CFI enabled.

For example, Figure 1 illustrates how a business office that takes an object too calls a virtual business office gets translated into assembly amongst too without CFI. For simplicity, this was compiled amongst -O0 to preclude compiler optimization. Without CFI enabled, it loads the object's vtable pointer too calls the business office at the expected offset. With CFI enabled, it performs a fast-path outset banking concern agree to decide if the pointer falls inside an expected attain of addresses of compatible vtables. Failing that, execution falls through to a deadening path that does a to a greater extent than extensive banking concern agree for valid classes that are defined inwards other shared libraries. The deadening path volition abort execution if the vtable pointer points to an invalid target.

With command period of time tightly restricted to a pocket-size ready of legitimate targets, code-reuse attacks larn harder to utilize too to a greater extent than or less retentiveness corruption vulnerabilities larn to a greater extent than hard or fifty-fifty impossible to exploit.

In damage of performance impact, LLVM's CFI requires compiling amongst Link-Time Optimization (LTO). LTO preserves the LLVM bitcode representation of object files until link-time, which allows the compiler to amend argue almost what optimizations tin hold upward performed. Enabling LTO reduces the size of the finally binary too improves performance, merely increases compile time. In testing on Android, the combination of LTO too CFI results inwards negligible overhead to code size too performance; inwards a few cases both improved.

For to a greater extent than technical details almost CFI too how other forward-control checks are handled, run into the LLVM pattern documentation.

For Android P, CFI is enabled yesteryear default widely inside the media frameworks too other security-critical components, such every bit NFC too Bluetooth. CFI gist support has also been introduced into the Android mutual gist when edifice amongst LLVM, providing the selection to farther harden the trusted computing base. This tin hold upward tested today on the HiKey reference boards.

Integer Overflow Sanitization

The UndefinedBehaviorSanitizer's (UBSan) signed too unsigned integer overflow sanitization was outset utilized when hardening the media stack inwards Android Nougat. This sanitization is designed to safely abort procedure execution if a signed or unsigned integer overflows yesteryear instrumenting arithmetics instructions which may overflow. The terminate lawsuit is the mitigation of an entire aeroplane of retentiveness corruption too information disclosure vulnerabilities where the root movement is an integer overflow, such every bit the master copy Stagefright vulnerability.

Because of their success, we've expanded usage of these sanitizers inwards the media framework amongst each release. Improvements own got been made to LLVM's integer overflow sanitizers to cut back the performance touching on yesteryear using fewer instructions inwards ARM 32-bit too removing unnecessary checks. In testing, these improvements reduced the sanitizers' performance overhead yesteryear over 75% inwards Android's 32-bit libstagefright library for to a greater extent than or less codecs. Improved Android construct arrangement support, such every bit amend diagnostics support, to a greater extent than sensible crashes, too globally sanitized integer overflow targets for testing own got also expedited the rollout of these sanitizers.

We've prioritized enabling integer overflow sanitization inwards libraries where complex untrusted input is processed or where at that topographic point own got been safety bulletin-level integer overflow vulnerabilities reported. As a result, inwards Android P the next libraries forthwith create goodness from this mitigation:

  • libui
  • libnl
  • libmediaplayerservice
  • libexif
  • libdrmclearkeyplugin
  • libreverbwrapper

Future Plans

Moving forward, we're expanding our usage of these mitigation technologies too nosotros strongly encourage vendors to create the same amongst their customizations. More information almost how to enable too seek out these options volition hold upward available shortly on the Android Open Source Project.

Acknowledgements: This post service was developed inwards articulation collaboration amongst Vishwath Mohan, Jeffrey Vander Stoep, Joel Galenson, too Sami Tolvanen