0

Okay, so I turn on my laptop, sign in to my regular user account and proceed to open/run a Java-based, HTTP-proxying application called burp via Terminal.app. It executes normally but refuses to bind with ports 80:http & 443:https. I assume the error is privilege related so I..

user@MacBook-Pro:~$login
login:root
Password:********

..successfuly log in as the root user and..

root@MacBook-Pro:~#open /Users/user/Downloads/burpsuite_free_v1.6.01.jar

..returns the following error:

LSOpenURLsWithRole() failed with error -10810 for the file
/Users/user/Downloads/burpsuite_free_v1.6.01.jar.`

However, I don't observe this error when signed in as a regular user; nor do I observe this error when signed in as root via OS X's graphical user interface.

I'm not sure why burp refuses bind to ports 80:http & 443:https. If it's merely an error due to (chown) ownership and (chmod) permissions; i would have thought having root access was supposed to transcend such limitations.

Based on this question and answer I can see what the LSOpenURLsWithRole() & error -10810 mean. I'm getting this error because the .jar file isn't a runnable application.

But how do I fix this and get this working on my machine?

7
  • LSOpenURLsWithRole() failed with error -10810 would imply the executable isn't actually executable, so yes, a perms issue, though idk why it wouldn't work with root in that case.
    – Tetsujin
    Commented Aug 26, 2015 at 13:13
  • Thanks for your comment. It's an odd situation; seems to obey no logic. Are there any details i should add? It's my first time submitting a question. I tried to be as thorough as possible.
    – voices
    Commented Aug 26, 2015 at 13:28
  • I found this - but I'm not really familiar with java - apple.stackexchange.com/questions/130587/…
    – Tetsujin
    Commented Aug 26, 2015 at 14:41
  • 1
    I gave you more latitude than most by not closing this question. All opinions on pedantry aside, the site rules are explicit about asking too broad of a question. See help center if your question has many valid answers, it's probably too broad for our format. There's no reason why #3 and #1 have the same answer. If you count the ? you have loaded 5 questions here.
    – bmike
    Commented Aug 31, 2015 at 16:19
  • 1
    The Q&A here answers your questions "What exactly are LSOpenURLsWithRole() & error -10810? / Why am i getting this error?" I'm editing this down to just "How do I fix this?" as that's the real heart of what you want to know right now.
    – Ian C.
    Commented Sep 22, 2015 at 3:39

1 Answer 1

1

You cannot, normally, run a .jar file (which is a Java ARchive file) using the open command on OS X. It's not a executable file, it doesn't give the system any hints about how it should be run normally, so open is giving you the LSOpenURLsWithRole() error you see above.

First, you'll need to install Java on your Mac. The easiest way to do this is to open a Terminal.app window and type:

java -version

If that returns a java version like this:

IanCsiMac:~ |ruby-2.1.5|
> java -version
java version "1.8.0_20"
Java(TM) SE Runtime Environment (build 1.8.0_20-b26)
Java HotSpot(TM) 64-Bit Server VM (build 25.20-b23, mixed mode)

You're done. Java is ready to be used. If java isn't present on your system, running that command will pop up a window asking if you want to install it. Follow the prompts and when you're done, java -version will show you something like what you see above. The version may be different, but the command will now work.

Now you need to run your .jar file using the java command. You need to provide three options to the java command in order for this to work:

  1. The -jar option which tells java you're running the contents of a Java ARchive file;
  2. A memory option for the Java Virtual Machine in the form -Xmx1024m; and finally
  3. The path to the .jar file on disk.

For your download it's all going to look like this:

java -jar -Xmx1024m /Users/user/Downloads/burpsuite_free_v1.6.01.jar

That will start the program HOWEVER it still won't be able to bind to ports 80 and 443. Those are protected ports. Ports <1024 on any Mac OS X machine can only be bound to be processes started as root.

The correct way to run programs as root is to use the sudo command, not to login as the root user. This provides a level of control and indirection to your actions so you don't do something accidentally silly like rm -rf / without a prompt asking you if you're sure you want to do such a silly thing.

So, the final form of your command will be:

sudo java -jar -Xmx1024m /Users/user/Downloads/burpsuite_free_v1.6.01.jar

You'll be prompted for your password and, assuming nothing else is already bound to ports 80 and 443, your application will start and being listening on those ports.

If it fails because it cannot bind to 80 and 443, you'll need to find out what's bound there already and shut it down. You can use the lsof command to figure this out.

For port 80 the call is:

sudo lsof -iTCP:80 -sTCP:LISTEN -n -P

For 443 it's:

sudo lsof -iTCP:443 -sTCP:LISTEN -n -P

The output from that command, assuming something is listening on the port, will look something like this:

> sudo lsof -iTCP:80 -sTCP:LISTEN -n -P
COMMAND PID USER   FD   TYPE             DEVICE SIZE/OFF NODE NAME
nginx    50 root    9u  IPv6 0x8978b255ac4ef0b7      0t0  TCP *:80 (LISTEN)

As you can see, I have a process named nginx listening port 80. It has process ID 50.

I can kill that process with:

sudo pkill nginx

That doesn't necessarily guarantee it won't try and come back, but how to deal with this fully and completely is best stated as entirely separate question on the site altogether.

1
  • I don't think so. Java is present and up to date on the system. Also; if I login as root via GUI all ports work fine. But if I login as my regular account via GUI the ports have issues, even with sudo. I only get the LSOpenURLsWithRole() & error -10810 message if I log in as a regular user via GUI and then login as root via CLI (Originally, I only did this only out of curiosity and for troubleshooting) . In all these cases; the open command was sufficient to execute the .jar & in all these cases; there's actually nothing yet bound to either of the ports in question. That's why it's odd.
    – voices
    Commented Sep 22, 2015 at 5:48

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .