5

I am running some self written Winforms .net 3.5 applications from a shared folder in Windows 10.

Everything worked correctly, but after the last big update (1803) the application doesn't start any more.

It seems that the program is crashing in the moment it is trying to open a socket. The first problem was when accessing the database it got the following exception:

2018-05-03 14:36:32,314 [1] ERROR NHibernate.Transaction.AdoTransaction [(null)] - Begin transaction failed
MySql.Data.MySqlClient.MySqlException: Unable to connect to any of the specified MySQL hosts. ---> System.Net.Sockets.SocketException: invalid argument
   at System.Net.Sockets.Socket..ctor(AddressFamily addressFamily, SocketType socketType, ProtocolType protocolType)
   at MySql.Data.Common.MyNetworkStream.CreateSocketStream(MySqlConnectionStringBuilder settings, IPAddress ip, Boolean unix)
   at MySql.Data.Common.MyNetworkStream.CreateStream(MySqlConnectionStringBuilder settings, Boolean unix)
   at MySql.Data.Common.StreamCreator.GetStream(MySqlConnectionStringBuilder settings)
   at MySql.Data.MySqlClient.NativeDriver.Open()

I've tried to work around this issue, but even accessing a SSH server didn't work when the program is started from the network share:

2018-05-03 14:30:30,654 [1] ERROR WinForms.SpringApplication [(null)] - Main Handler
Tamir.SharpSsh.jsch.JSchException: System.Net.Sockets.SocketException: invalid argument
   at System.Net.Sockets.Socket..ctor(AddressFamily addressFamily, SocketType socketType, ProtocolType protocolType)
   at Tamir.SharpSsh.java.net.Socket..ctor(String host, Int32 port)
   at Tamir.SharpSsh.jsch.Util.createSocket(String host, Int32 port, Int32 timeout)
   bei Tamir.SharpSsh.jsch.Session.connect(Int32 connectTimeout)
   bei Tamir.SharpSsh.SshBase.ConnectSession(Int32 tcpPort)
   bei Tamir.SharpSsh.SshBase.Connect(Int32 tcpPort)
   bei Tamir.SharpSsh.SshBase.Connect()

When I copy the directory locally the program works fine.

Any ideas why it seems that Windows is blocking access to sockets when I'm starting this program from a network share ?

I know about trusting .net code, so it can be run from a network share, but I've renewed the full trust and it still crashes (and normally it crashes much earlier if I didn't do a full trust).

bernhardrusch
  • 11,670
  • 12
  • 48
  • 59
  • 1803 was originally planned for 12th April. It was delayed to 1st May due to issues. As this is a Kernel Update, I fully expect temporary such issues with older programms. – Christopher May 03 '18 at 12:53
  • @Christopher this isn't temporary nor surprising. The eventual removal of SMB v1 was announced back in 2015 – Panagiotis Kanavos May 16 '18 at 07:11
  • @PanagiotisKanavos - for me it was surprising. The strange thing was that I could open the files just fine, but it blocked network access from these locations. I wish Windows would release better release notes. The solution was easy - we just had to configure our SMB server to use the newer version. – bernhardrusch May 16 '18 at 07:55
  • @bernhardrusch the [warnings were out there](https://blogs.technet.microsoft.com/filecab/2016/09/16/stop-using-smb1/) for *years*. The release notes were out there as well, including roadmaps, security bulletings, [KB articles](https://support.microsoft.com/en-us/help/4034314/smbv1-is-not-installed-by-default-in-windows). The ransomware attacks of the last couple of years should have forced everyone to stop using SMB v1. There's really no excuse for using an insecure protocol after Petya – Panagiotis Kanavos May 16 '18 at 08:48
  • @bernhardrusch I'll accept that it's *very* surprising to discover that your network is *still* using SMB v1. Especially when it was supposed to be patched and modernized already. Better that than a Petya attack though. – Panagiotis Kanavos May 16 '18 at 08:53
  • @bernhardrusch the KB article may have an April 2018 update date but you can find mentions to it going backt to November. Windows 10 already came with SMBv1 disabled. [Check this forum question from July 2017](https://community.netgear.com/t5/Nighthawk-WiFi-Routers/SMBv1-disabled-Readyshare-unavailable/td-p/1318587) – Panagiotis Kanavos May 16 '18 at 09:02
  • @PanagiotisKanavos thank you for all the information – bernhardrusch May 16 '18 at 09:45

3 Answers3

6

We have some information about this issue:

Windows 10 update 1803 does not open network connections on executables files on SMBv1 share (as Windows Server 2003)

You can try to move your program to a SMBv2 or SMBv3 compatible server to check it.

Israel T
  • 86
  • 2
  • changing the (linux) server to use SMBv2 solved the problem - Thank you for your help ! – bernhardrusch May 08 '18 at 07:22
  • This was my problem too, but in my case SMBv2 was disabled (I don't know why) on the server so only SMBv1 was active and in use – Massimo Spinelli May 10 '18 at 08:50
  • @Israel Your information is correct but I can't find *any* official information about this "feature". Do you know about any official info from Microsoft regarding it? Can this "feature" be disabled somehow? – Miroslav Prymek May 15 '18 at 12:52
  • @MiroslavPrymek These might help: https://support.microsoft.com/en-us/help/4034314/smbv1-is-not-installed-by-default-in-windows and https://blogs.technet.microsoft.com/filecab/2016/09/16/stop-using-smb1/ – Giorgi Chakhidze May 27 '18 at 20:35
  • @GeorgeChakhidze I'm sorry but I don't see any statement saying the binary run from SMB1 share cannot use IP networking. – Miroslav Prymek May 30 '18 at 19:32
3

Microsoft fixed this on June 26, 2018 in the 2018-06 Cumulative Update for Windows 10 Version 1803 for x64-based Systems (KB4284848) (OS Build 17134.137).

One of the fixes is relevant:

Addresses an issue where some users may receive an error when accessing files or running programs from a shared folder using the SMBv1 protocol. The error is "An invalid argument was supplied".

This and other workarounds are discussed in:

https://blog.mertech.com/windows-10-version-1803-breaks-some-shared-folder-applications

finch
  • 549
  • 1
  • 6
  • 18
flxkid
  • 1,441
  • 1
  • 13
  • 21
  • KB4284848 fixed a similar System.Net.Sockets.SocketException for me in Visual Studio 2015, where the exception came up when my solution was on a Buffalo NAS drive with SMB1, but not on a local drive. – finch Jul 04 '18 at 09:31
1

I test this - if server allow SMBv1 only (max) any connection can't be create from executables from shared. If SMB is v2, all works fine.

Dżyszla
  • 59
  • 8