JLospinoso / beamgun

A rogue-USB-device defeat program for Windows.
https://jlospinoso.github.io/beamgun/
GNU Affero General Public License v3.0
187 stars 33 forks source link

0.2.2 crashes when ran using "Run as administrator" #6

Open alex-ilin opened 7 years ago

alex-ilin commented 7 years ago

I've installed v0.2.2 from the MSI package. I'm running a non-admin account on my Win8.1 machine. When I right-click BeamgunApp.exe and choose "Run as administrator" from the context menu, it simply crashes right away.

JLospinoso commented 7 years ago

@AlexIljin Thanks for reporting! When you don't run as administrator, does Beamgun start?

I think this is the case from your other issue.

Could you try running from an administrator account and see if it crashes?

alex-ilin commented 7 years ago

Yes, it does start and run for my non-admin account. It does lock the account when I plug in my USB keyboard, and after I type in the password, it proceeds to mirror all input from the keyboard into its log (I have all settings by default, so both Steal focus and Lock workstation are checked). The dog is pictured with a duck in its paw.

When I log into my admin account and start the app, the UAC pops up the question, and after I click Yes it crashes anyway.

PS: found out about the app on the "Security Now!" podcast.

JLospinoso commented 7 years ago

@AlexIljin Ok thanks. What does it say when it crashes? Do you have a stack trace?

alex-ilin commented 7 years ago

I have tried starting the VS2015 debugger on it, but I have some issues signing in from my admin account, because I haven't ever used the VS that way. What I was able to find out is that the crash is caused by a null pointer reference exception. No stack trace, unfortunately.

JLospinoso commented 7 years ago

Okay interesting. If you right click on VS, "Run as Administrator," you should be able to debug as admin. Does that not work? Maybe we could also run ProcMon ( https://technet.microsoft.com/en-us/sysinternals/processmonitor.aspx) to see what the last things the program was doing?

On Thu, Dec 8, 2016 at 4:14 AM, Alexander Iljin notifications@github.com wrote:

I have tried starting the VS2015 debugger on it, but I have some issues signing in from my admin account, because I haven't ever used the VS that way. What I was able to find out is that the crash is caused by a null pointer reference exception. No stack trace, unfortunately.

— You are receiving this because you commented. Reply to this email directly, view it on GitHub https://github.com/JLospinoso/beamgun/issues/6#issuecomment-265703877, or mute the thread https://github.com/notifications/unsubscribe-auth/AAJA8qClJAbl3w_hI01UKZUY6VrPTyP9ks5rF9hygaJpZM4LG6Tv .

-- Josh Lospinoso e: josh@lospi.net p: (317) 455-6774

http://lospi.net

CONFIDENTIALITY NOTICE: This email communication may contain private, confidential, or legally privileged information intended for the sole use of the designated and/or duly authorized recipient(s). If you are not the intended recipient or have received this email in error, please notify the sender immediately by email and permanently delete all copies of this email including all attachments without reading them. If you are the intended recipient, secure the contents in a manner that conforms to all applicable state and/or federal requirements related to privacy and confidentiality of such information.

pub 4096R/EEB683C4 2016-01-22 [expires: 2021-01-20] Key fingerprint = 75F1 21C8 A146 FE98 ED44 9978 DE82 E75C EEB6 83C4 uid Josh Lospinoso josh@lospi.net sub 4096R/AE4D612F 2016-01-22 [expires: 2021-01-20]

JLospinoso commented 7 years ago

@AlexIljin, I found an issue with ArgumentNullException in certain situations when the version checker tries to poll for the latest version number:

                var url = settings.VersionUrl + "?id=" + settings.BeamgunId + "&ver=" + Assembly.GetExecutingAssembly().GetName().Version;
                using (var data = client.OpenRead(Uri.EscapeUriString(url)))
                {
                    if (data == null)
                    {
                        throw new Exception("Could not connect to update server.");
                    }
                    using (var reader = new StreamReader(data))
                    {
                        versionJson = JObject.Parse(reader.ReadToEnd());
                    }

(Around line 17 of https://github.com/JLospinoso/beamgun/blob/master/BeamgunApp/Models/VersionChecker.cs)

The client.OpenRead call throws a System.ArgumentNullException for value, but it's not null when I put a debug break there. Very strange. When continuing, I then get a System.Security.Authentication.AuthenticationException, and a System.ObjectDisposedException.

This task is on a timer, and I'm wondering if, for some reason, in your environment this causes a crash whereas in mine it's just handling the exceptions and continuing on.

Let me know if this sounds like the issue you're seeing.

I'll investigate today.

JLospinoso commented 7 years ago

@AlexIljin, I've made a fix to the WIX installer where I remove the Impersonate attribute in Library.wxs:

<CustomAction Id="LaunchApplication" BinaryKey="WixCA" DllEntry="WixShellExec"/>

Could this be related to your issue? Were you only running into in after installation, or do you also have the problem when you start the .exe directly?

Also, are you sure there are no other instances of Beamgun running?

alex-ilin commented 7 years ago

@JLospinoso: "Also, are you sure there are no other instances of Beamgun running?"

Yes, 100% sure.

@JLospinoso: "Were you only running into in after installation, or do you also have the problem when you start the .exe directly?"

I have installed it from MSI, but each time I ran it I was double-clicking BeamgunApp.exe. I did not use the "Run" checkbox at the end of the installation.

JLospinoso commented 7 years ago

Okay, it looks like we're going to need to attach a debugger. As you attempted to do, I think it will be best to work through the VS2015 issues.

Where in the Visual Studio >> Run as Administrator >> Open Beamgun >> Run are you running into issues?

On Thu, Dec 8, 2016 at 1:04 PM, Alexander Iljin notifications@github.com wrote:

@JLospinoso https://github.com/JLospinoso: "Also, are you sure there are no other instances of Beamgun running?"

Yes, 100% sure.

@JLospinoso https://github.com/JLospinoso: "Were you only running into in after installation, or do you also have the problem when you start the .exe directly?"

I have installed it from MSI, but each time I ran it I was double-clicking BeamgunApp.exe. I did not use the "Run" checkbox at the end of the installation.

— You are receiving this because you were mentioned. Reply to this email directly, view it on GitHub https://github.com/JLospinoso/beamgun/issues/6#issuecomment-265825267, or mute the thread https://github.com/notifications/unsubscribe-auth/AAJA8jXYzQ8wYEnkOQGkqCmqtPwEAVo2ks5rGFTKgaJpZM4LG6Tv .

-- Josh Lospinoso e: josh@lospi.net p: (317) 455-6774

http://lospi.net

CONFIDENTIALITY NOTICE: This email communication may contain private, confidential, or legally privileged information intended for the sole use of the designated and/or duly authorized recipient(s). If you are not the intended recipient or have received this email in error, please notify the sender immediately by email and permanently delete all copies of this email including all attachments without reading them. If you are the intended recipient, secure the contents in a manner that conforms to all applicable state and/or federal requirements related to privacy and confidentiality of such information.

pub 4096R/EEB683C4 2016-01-22 [expires: 2021-01-20] Key fingerprint = 75F1 21C8 A146 FE98 ED44 9978 DE82 E75C EEB6 83C4 uid Josh Lospinoso josh@lospi.net sub 4096R/AE4D612F 2016-01-22 [expires: 2021-01-20]