6 ms·
> In any case, I don't think there can be any opposing arguments on the side of security for Apple not updating Safari via AppStore or now allowing proper 3rd p
by saagarjha 7y ago
> In any case, I don't think there can be any opposing arguments on the side of security for Apple not updating Safari via AppStore or now allowing proper 3rd party browsers.
Third party browsers entitled with dynamic codesigning poke a huge hole in Apple's security model for iOS devices.
- Jyaif 7y agoCan you explain why allowing apps to ship with a JIT compiler be a security issue?
- acdha 7y agoThink about what a JIT compiler means: it's allocating memory, writing to it, and then executing it. That's also what malware does so if you give third parties access to that functionality you have the immediate problem that the number of people who can make a mistake which gives native code execution goes up dramatically and that any attempts to restrict it in the future will risk breaking previously-working apps — think about how many years Adobe was able to slack because nobody wanted to break Flash even though it was a huge source of security bugs affecting most people on the Internet.
- Someone 7y agoA common attack method is to overwrite the stack or some buffer and then somehow make the CPU run the bytes written as code (https://en.wikipedia.org/wiki/Buffer_overflow#Exploitation https://en.wikipedia.org/wiki/Buffer_overflow#Exploitation, https://en.wikipedia.org/wiki/Buffer_overflow#Heap-based_exploitation https://en.wikipedia.org/wiki/Buffer_overflow#Heap-based_exp...) A common mitigation to that is “write xor execute” (https://en.wikipedia.org/wiki/W%5EX https://en.wikipedia.org/wiki/W%5EX) From that page: ”Without such protection, a program can write (as data) CPU instructions in an area of memory intended for data and then arrange to run (as executable) those instructions. This can be dangerous if the writer of the memory is malicious.” JIT compilers are collateral damage to that mitigation; they have to write bytes to memory and then make the CPU run those bytes as code, and W^X doesn’t allow that.
- saagarjha 7y agoFWIW, switching memory from RW- to R-X (which is still W^X) is also not allowed unless you have certain, easier to get entitlements.
- saagarjha 7y agoApple's security model for iOS, as far as I can tell, is to be able to analyze all executable code in applications at review time. Being able to dynamically generate code does not work with this policy.
- vbezhenar 7y agoApple libraries use private APIs but developers must not use them directly. If you allow developers to execute arbitrary bytes, they can submit app which does not call private API but will be able to call them later after approve. JavaScript is safe, because it can't call C API, but arbitrary JIT engine is not.
- fragmede 7y agoSandboxing a JIT compiler is impossible to do perfectly, so there will always be the possibility of a sandbox escape, allowing the device to be jailbroken; but alsio for bad actors to take control of the device.
- tpetry 7y agoThey could limit this functionality to only their apps. No problem.
- saagarjha 7y agoThat wouldn't work for third-party browsers.
- Abishek_Muthian 7y agoThat doesn't explain why it fails to update Safari via AppStore. Also Apple has been allowing coding apps for years now which can download and run executable code, so it is hard to buy the argument.
- saagarjha 7y ago> That doesn't explain why it fails to update Safari via AppStore. Another reason is that it's extra work to decouple the browser with the OS. > Also Apple has been allowing coding apps for years now which can download and run executable code, so it is hard to buy the argument. Not native code.
- Abishek_Muthian 7y ago> it's extra work to decouple the browser with the OS. It is expected of a company which boasts about security and privacy of its users as a premium selling point, although it is questionable now[1]. Besides, MacOS has been receiving Safari updates separately. Also android has been decoupling several system services with every iteration now, soon crucial system services would be updated from PlayStore and so even if the manufacturer doesn't ship OS updates, important services would stay updated. [1]: https://arstechnica.com/information-technology/2019/09/apple-takes-flak-for-disputing-ios-security-bombshell-dropped-by-google/ https://arstechnica.com/information-technology/2019/09/apple...
- saagarjha 7y ago> Besides, MacOS has been receiving Safari updates separately. Sure, but the company is doing extra work to provide this. It might be a worthwhile decision to make but it’s certainly not a free gain.
- eyo2019 7y ago> Another reason is that it's extra work to decouple the browser with the OS. I thought that argument was rejected already in 2001[0]. [0]: https://en.wikipedia.org/wiki/United_States_v._Microsoft_Corp https://en.wikipedia.org/wiki/United_States_v._Microsoft_Cor.... --- (edited to fix link formatting)
- rictic 7y agoDo you mean the ability to dynamically allocate executable memory? That's not necessary for shipping a browser engine (though performance would suffer, as that's how all modern JS VMs work, via jitting JS to machine code).
- saagarjha 7y agoYes. It's not necessary for a browser engine to do this, of course, but AFAIK the best interpreters can only approach or barely match simple templating JITs so you're probably not going to be able to write a competitive browser without this.