norio-nomura / EasySIMBL

EasySIMBL is modified "SIMBL" for OS X 10.7, 10.8, 10.9 or 10.10 supporting sandbox, resume. No installer.
818 stars 76 forks source link

Issues with EasySIMBL and OS X 10.11 El Capitan #26

Open antons opened 9 years ago

antons commented 9 years ago

It appears that 10.11b1 is not affected by the issue described in #25.

However, one of my plugins which previously injected into the target app just fine, now has issues.

Plugin is injected into the app only if I do the following.

  1. Restart the system.
  2. Launch Gitbox.
  3. Launch EasySIMBL, and check “Use SIMBL” (it is disabled on every relaunch of the system).

If I initially turn on SIMBL before launching Gitbox, or quit Gitbox after the first injection and launch it again, the following message is logged into console (and the plugin is not injected).

09.06.15 18:06:32,626 Gitbox[1219]: Error loading /Users/Anton/Library/ScriptingAdditions/EasySIMBL.osax/Contents/MacOS/EasySIMBL:  dlopen(/Users/Anton/Library/ScriptingAdditions/EasySIMBL.osax/Contents/MacOS/EasySIMBL, 262): no suitable image found.  Did find:
    /Users/Anton/Library/ScriptingAdditions/EasySIMBL.osax/Contents/MacOS/EasySIMBL: open() failed with errno=24

Any thoughts on what might be causing this?

norio-nomura commented 9 years ago

I have not yet tested on OS X 10.11, but I think it will be checked by attaching debugger to Gitbox. On debugger's console, I did following:

(lldb) call (void*)dlopen("/Users/norio/Library/ScriptingAdditions/EasySIMBL.osax/Contents/MacOS/EasySIMBL",0)
(void *) $0 = 0x0000608000167980

and did resume the process. On OS X 10.10.4 (14E33b), I got Gitbox Tweaks 1.2 working on Gitbox 1.6.2 with above.

Maybe it will be possible for open() or other APIs.

jensfrancis commented 9 years ago

Tested SafariStrand on EasySIMBL with OS X 10.11 Build 15A178w. No dice.

catlan commented 9 years ago

Runtime protections

Injecting code into a process is equivalent to modifying the binary on disk Processes are marked restricted by the kernel

https://forums.developer.apple.com/message/7363#7363

antons commented 9 years ago

@catlan I’m not sure how rutime protection is related to my question, considering that the issue is only with one app, which loads plugins, but once, and only fails to do it again unless the system is restarted. Other plugins are injected into other apps without any issues.

orbitly commented 9 years ago

Can confirm it continues to not work on beta 2 (15A204h)

d235j commented 9 years ago

@orbitly: 10.11 developer preview 2 has begun enforcing code injection restrictions. You will need to boot into recovery mode and disable System Integrity Protection for EasySIMBL to work.

catlan commented 9 years ago

@d235j can you confirm that System Integrity Protection protects all apps from code injection or does it just protect system apps?

fjolnir commented 9 years ago

Disabling SIP didn't fix things for me. (TotalFinder on the other hand did start working after disabling it)

rpendleton commented 9 years ago

@catlan @d235j I don't have the beta installed, but the WWDC slides say System Integrity Protection will "Prevent runtime attachment and code injection into system binaries." It wouldn't surprise me if injection still works with normal apps.

norio-nomura commented 9 years ago

Maybe #25 will prevent EasySIMBL working if SIP is disabled on OS X 10.11.

w0lfschild commented 9 years ago

Yup even with SIP off on 10.11 (15A204h) I'm not having success with anything loading.

rpendleton commented 9 years ago

@norio-nomura It looks like that's probably the problem.

I just installed a VM of OS X 10.11. To ensure that SIP was enabled, I tried to create a file in /System/ as root and I received an operation not permitted error. When I tried to inject code using my own method, it worked fine on some executables but not others.

$ ls
2015-06-28 22:34:10.827 ls[404:6219] TestInject Loaded
Desktop
Documents
Downloads
Library
Movies
Music
Pictures
Public

$ /Applications/TextEdit.app/Contents/MacOS/TextEdit
2015-06-28 22:36:14.378 TextEdit[405:6555] TestInject Loaded

I was able to inject code into Console, Terminal, TextEdit, ls, and a few others. However, I was not able to inject code into Finder, Safari, or Notes.

norio-nomura commented 9 years ago

FYI about SIP http://blog.binaryage.com/el-capitan-update/

norio-nomura commented 9 years ago

I confirmed that the original SIMBL-0.9.9 placed at /System/Library/ScriptingAdditions/ works on SIP enabled OS X 10.11 (15A284). (Disabling SIP is needed while installing SIMBL.)

Steps of installing SIMBL-0.9.9:

  1. Disable SIP: enter Recovery OS, run csrutil disable and reboot.
  2. Run following on terminal for installing SIMBL-0.9.9 at /System/Library/ScriptingAdditions/
sudo installer -verbose -pkg Downloads/SIMBL-0.9.9/SIMBL-0.9.9.pkg -target /
sudo rm -rf /System/Library/ScriptingAdditions/SIMBL.osax
sudo mv /Library/ScriptingAdditions/SIMBL.osax /System/Library/ScriptingAdditions/
sudo cp -p /System/Library/ScriptingAdditions/SIMBL.osax/Contents/Resources/SIMBL\ Agent.app/Contents/Resources/net.culater.SIMBL.Agent.plist /System/Library/LaunchAgents/
sudo sed -e "s/Library/System\/Library/" -i "" /System/Library/LaunchAgents/net.culater.SIMBL.Agent.plist
  1. Enable SIP: enter Recovery OS, run csrutil enable and reboot.

After above steps, Plugins placed at /Library/Application Support/SIMBL/Plugins will be loaded by SIMBL.

I confirmed that SafariStand 9.0.215 is injected into Safari 9.0 (11601.1.56) with above setup. SafariStand 9.0.215 is not tested on OS X 10.11 by author yet.

Notes:

Added following on 2015/07/02:

Edited on 2015/07/05:

Edited on 2015/09/05:

Edited on 2015/10/02:

norio-nomura commented 9 years ago

I wrote a note about injection mechanism of EasySIMBL extended from SIMBL-0.9.9 https://gist.github.com/norio-nomura/f4346e9cb9db0a411779

dvcrn commented 9 years ago

@norio-nomura thanks for the instructions. I was able to compile and run stand with the setup above!

Fofer commented 9 years ago

norio-nomura,

how does that demonstrate "SIMBL-0.9.9 working on SIP enabled OS X 10.11" if your very first step is "disabling SIP" and rebooting?

w0lfschild commented 9 years ago

@Fofer

Because the last step is turning it back on... You only need to turn off SIP to install SIMBL.

Fofer commented 9 years ago

Ah, gotcha, thanks.

I really hope we'll be able to keep using SafariStand in OS X 10.11.

norio-nomura commented 9 years ago

I updated the comment.

d235j commented 9 years ago

For whatever it's worth, Apple has already stated that changing SIP via boot-args will not be supported in the release version of El Capitan.

rpendleton commented 9 years ago

@d235j That's fine, as long as it can still be toggled from the recovery partition.

antons commented 9 years ago

@norio-nomura Have you ever encountered an issue where a plugin is injected when the app is launched from Xcode, but not when when launched from Finder? Using original SIMBL with your instructions.

norio-nomura commented 9 years ago

@antons Enabling debug logging may help you.

defaults write net.culater.SIMBL SIMBLLogLevel -int 0

from https://code.google.com/p/simbl/wiki/Tutorial

antons commented 9 years ago

@norio-nomura Thank you very much for continuing to check issues, even though you don’t use SIMBL yourself.

I’ll leave this for anyone who may encounter the same issue. Unfortunately the logs weren’t helpful.

From Finder.

13.07.15 14:41:59,445 SIMBL Agent[506]: Gitbox started
13.07.15 14:41:59,446 SIMBL Agent[506]: app start notification: {
    NSApplicationBundleIdentifier = "com.oleganza.gitbox";
    NSApplicationName = Gitbox;
    NSApplicationPath = "/Applications/Gitbox.app";
    NSApplicationProcessIdentifier = 72631;
    NSApplicationProcessSerialNumberHigh = 0;
    NSApplicationProcessSerialNumberLow = 6231537;
    NSWorkspaceApplicationKey = <NSRunningApplication: 0x40013a820 (com.oleganza.gitbox - 72631)>;
}
13.07.15 14:41:59,446 SIMBL Agent[506]: checking bundle /Users/Anton/Library/Application Support/SIMBL/Plugins/Gitbox Tweaks SIMBL Plugin.bundle
13.07.15 14:41:59,447 SIMBL Agent[506]: checking target identifier com.oleganza.gitbox
13.07.15 14:41:59,447 SIMBL Agent[506]: send inject event
13.07.15 14:41:59,448 SIMBL Agent[506]: warning: failed to get scripting definition from /Applications/Gitbox.app; it may not be scriptable.
13.07.15 14:41:59,702 SIMBL Agent[506]: eventDidFail:'tvea' error:Error Domain=NSOSStatusErrorDomain Code=-1708 "The operation couldn’t be completed. (OSStatus error -1708.)" (errAEEventNotHandled: the AppleEvent was not handled by any handler ) UserInfo=0x400182700 {ErrorNumber=-1708} userInfo:{
    ErrorNumber = -1708;
}

From Xcode.

13.07.15 14:43:55,518 SIMBL Agent[506]: Gitbox started
13.07.15 14:43:55,519 SIMBL Agent[506]: app start notification: {
    NSApplicationBundleIdentifier = "com.oleganza.gitbox";
    NSApplicationName = Gitbox;
    NSApplicationPath = "/Applications/Gitbox.app";
    NSApplicationProcessIdentifier = 73651;
    NSApplicationProcessSerialNumberHigh = 0;
    NSApplicationProcessSerialNumberLow = 6247925;
    NSWorkspaceApplicationKey = <NSRunningApplication: 0x4001cd400 (com.oleganza.gitbox - 73651)>;
}
13.07.15 14:43:55,519 SIMBL Agent[506]: checking bundle /Users/Anton/Library/Application Support/SIMBL/Plugins/Gitbox Tweaks SIMBL Plugin.bundle
13.07.15 14:43:55,520 SIMBL Agent[506]: checking target identifier com.oleganza.gitbox
13.07.15 14:43:55,520 SIMBL Agent[506]: send inject event
13.07.15 14:43:55,521 SIMBL Agent[506]: warning: failed to get scripting definition from /Applications/Gitbox.app; it may not be scriptable.
13.07.15 14:43:55,974 Gitbox[73651]: Performance: Please update this scripting addition to supply a value for ThreadSafe for each event handler: "/System/Library/ScriptingAdditions/SIMBL.osax"
13.07.15 14:43:55,976 SIMBL Agent[506]: eventDidFail:'tvea' error:Error Domain=NSOSStatusErrorDomain Code=-1708 "The operation couldn’t be completed. (OSStatus error -1708.)" (errAEEventNotHandled: the AppleEvent was not handled by any handler ) UserInfo=0x400123900 {ErrorNumber=-1708} userInfo:{
    ErrorNumber = -1708;
}
13.07.15 14:43:56,084 Gitbox[73651]: load SIMBL plugins
13.07.15 14:43:56,084 Gitbox[73651]: SIMBL loaded by path /Applications/Gitbox.app <com.oleganza.gitbox>
13.07.15 14:43:56,084 Gitbox[73651]: checking bundle /Users/Anton/Library/Application Support/SIMBL/Plugins/Gitbox Tweaks SIMBL Plugin.bundle
13.07.15 14:43:56,193 Gitbox[73651]: loaded /Users/Anton/Library/Application Support/SIMBL/Plugins/Gitbox Tweaks SIMBL Plugin.bundle
alisookasa commented 9 years ago

@antons I got this error once when I tried to run SIMBL Agent app without running through the pkg installer; the simbl.pkg register the ScritptingAdditions under /Library, which is essential to make the injection work.

In my case, I had to run the installer once, then re-run the SIMBL Agent app.

norio-nomura commented 9 years ago

@antons It seems SIMBL Agent.app recognized launching of target application, but failed injecting SIMBL.osax into target application. If you could inject by sending Apple Event manually, The issue may be caused by SIMBL Agent.app. EasySIMBL's timing of sending Apple Event is slightly different from original SIMBL. It caused from change of observing launching applications method for fixing injection issues while I found on creating my plugins. I don't remember the detail of those issues, but it might had contained one of debugging issue.

antons commented 9 years ago

My issue (Gitbox Tweaks not loading into Gitbox, while other plugins work) is gone after installing 10.11.0 beta 4. Issue is still there, same as described in the original post. Plugins loads once, fails to load after that. Always loads when running from Xcode. So I just run it from Xcode, then detach it (process detach) from Gitbox.

codebykenny commented 9 years ago

@norio-nomura Your steps helped me get SIMBL working again.

Thanks!

levifig commented 9 years ago

Disabling SIP to install SIMBL worked, but re-enabling SIP breaks it again… :\ (PB4 here)

KenV54 commented 9 years ago

I've got Afloat, which depends upon SIMBL, working on most apps except for Safari in 10.11 public preview beta 15A262e. I just manually added Afloat to the plugins in the SIMBL directory in the library. I still cannot get it to work with Safari, which is the way it used to be with Safari, at least before Yosemite, as I recall. I haven't yet done the SIP fix, because I'm thinking it might then have to be done again every time the OS X is updated. I'll try a reboot and comment back here if it works. If no comment, it didn't work of Safari.

KenV54 commented 9 years ago

Well, I'll comment anyway. It didn't work in Safari. I wonder if Apple has changed Safari back such that Afloat doesn't work in Safari no matter what, just as it used to be. Afloat works fine for me in Chrome and many other apps under El Capitan.

bwiernik commented 8 years ago

In preview beta 15A278b, the steps described no longer work. After installing SIMBL, the lines of the script that modify /System/Library/ScriptingAdditions/SIMBL.osax fail, even after disabling SIP.

KenV54 commented 8 years ago

I have the same preview beta 15A278b, have taken no steps to modify SIMBL, and, in fact, have no SIMBL.osax in the directory mentioned. My app that depends upon SIMBL, Afloat, works for most things except for Safari, as I mentioned in the post above. Prior to EC, Afloat was working for Safari, too. I wonder if Safari was changed back in some way to what it used to be in Mavericks, in which Afloat wouldn't work in Safari but did work in Chrome and Firefox.

norio-nomura commented 8 years ago

@bwiernik @KenV54 configuring SIP has been changed. I updated https://github.com/norio-nomura/EasySIMBL/issues/26#issuecomment-117028426 for OS X 10.11 Developer Beta 8 (15A279b).

KenV54 commented 8 years ago

Amazing. It worked! Thank you! I now have Afloat working again in Safari! It had been working with other apps before I went through the SIP configuration, but not in Safari, and now it does again.

I wonder if it will be necessary to go through this procedure every time I upgrade the El Capitan Preview beta or the official 10.11 release?

BrysovVadik commented 8 years ago

Safari 9.0 (11601.1.56). Did everything as described, but the icons appeared only in SideBar, and the tabs icon does not appear. In the Stand settings, Show Icon On Tab Bar checked. What can i do? Thanks.

KenV54 commented 8 years ago

I have Afloat working with Safari 9 again. Haven't tried SafariStand. Afloat was working with the latest El Capitan public preview release, but when I did the install of the EC GM Candidate yesterday--it was a full install, no upgrade available--I had to go through the whole process again with the CSRUTIL Disable described above.

I wonder if every OS upgrade in EC from now on will necessitate all those steps to make SIMBL work?

BrysovVadik commented 8 years ago

I did the procedure twice. No result.

norio-nomura commented 8 years ago

@BrysovVadik

In the Stand settings, Show Icon On Tab Bar checked.

It seems that SIMBL has successfully injected plugins into Safari. The rest of issues should be filed to plugin's project.

ballo commented 8 years ago

Someone has already released a simple tool to disable SIP:

http://1i0ny.de/apps/rootlesstoggler/

rpendleton commented 8 years ago

@ballo That only works on the first few betas, since it toggles rootless on and off by updating the nvram boot-args variable. In order to disable SIP on the more recent betas, you'll need to boot into recovery mode and use the csrutil command line utility.

iamdavid99 commented 8 years ago

Works for me on the GM

On Sep 21, 2015, at 17:16, Ryan Pendleton notifications@github.com wrote:

@ballo That only works on the first few betas, since it toggles rootless on and off by updating the nvram boot-args variable. In order to disable SIP on the more recent betas, you'll need to boot into recovery mode and use the csrutil command line utility.

— Reply to this email directly or view it on GitHub.

mdaddy commented 8 years ago

which version of easysimbl did you install? 1.7.1 or 0.9.9?

(I am on El Capitan)

mdaddy commented 8 years ago

Actually, I got safarstand to work by following the steps here: https://github.com/norio-nomura/EasySIMBL/issues/26#issuecomment-117028426

However, when I right click on an image in safari, safari just crashes. I have tried it multiple times.

InfAspire commented 8 years ago

Trying with the release version of El Capitan, following the instructions above, and I can't get it to work. Tried twice. I do not see the SafariStand plugin loaded in the SIMBL Agent when I check the open files in activity monitor. The latest SafariStand is in both /Library/Application Support/SIMBL/Plugins and ~/Library/Application Support/SIMBL/Plugins. I was user owned in /Library/Application Support/SIMBL/Plugins and I tried also with root owned but neither worked. I tried installing SIMBL both from command line and from the package installer.

Has anybody gotten it working with the 10.11 release version?

stewacide commented 8 years ago

Afloat has worked for me (apart from Safari and other system apps) in the El Capitan betas. What versions of Afloat+SIMBL do I want to install to have it working with Safari as well? (apparently I need to do a full OSX install to upgrade out of the beta, which I'm assuming will break everything)

KenV54 commented 8 years ago

@stewaside, you're correct about Afloat and everything but Safari with EC, even the latest versions. The only way to make Afloat work in Safari is to use the method in comment #26 above. It takes a little time, you have to go into recovery mode a couple times, but it works, and it seems to hold even with OS updates. It probably won't hold with an EC fresh install, and it's unclear at this point whether people with the OS 10.11.1 public beta will have to do a fresh install of 10.11 now that it's been released, or whether we can just upgrade over the beta releases.

norio-nomura commented 8 years ago

I updated https://github.com/norio-nomura/EasySIMBL/issues/26#issuecomment-117028426 for OS X 10.11 (15A284).

sha256 commented 8 years ago

I got it the SIMBL working by #26 (comment). Safari Stand also shows up in the menu bar of Safari. But Favicon in the tab is not working.

Also I got this after opening Safari.

screen shot 2015-10-02 at 10 56 17 am