Re: Sending raw sockets without administrative privileges?

From: Dominick Baier [DevelopMentor] (dbaier_at_pleasepleasenospamdevelop.com)
Date: 09/13/05


Date: Tue, 13 Sep 2005 00:56:07 -0700

Hello Christian Jacob cjacob AT nospam toptechnologies DOT de,

under which operating system are you running? I am surprised that this works
at all, as sending raw sockets on XP SP2 and W2K3 SP1 should be disabled
by now (but maybe not for ICMP...)

SocketPermission is a Code Access Security class and has nothing to do with
OS level privileges.

If you can upgrade to .NET 2.0 - there is an easy solution :)

using System.Net.NetworkInformation;

PingReply reply = new Ping().Send(args[0]);
Console.WriteLine("Reply from {0} - Roundtrip Time {1} ms", reply.Address,
reply.RoundTripTime);

---------------------------------------
Dominick Baier - DevelopMentor
http://www.leastprivilege.com

> Although I already have an own implementation for pinging remote
> hosts, I encountered problems which I hoped others may have already
> solved.
>
> The thing is, that all sources I found (including my own) use raw
> sockets to send ICMP echo requests. A user without administrative
> privileges does not have the permissions to create raw sockets though.
> This is why it simply does not work with user permissions. Here is an
> example from Microsoft: http://support.microsoft.com/kb/828993/en-us
>
> I thought maybe the SocketPermission class might help. But it seems
> that it is only capable of allowing TCP and UDP connections, not ICMP.
>
> Does anyone have a solution for this?
>
> Best regards,
> Christian Jacob.



Relevant Pages

  • Re: Http server implementation for Windows Media Server
    ... On that level that already extra raw data even not ... similar problem applies to me as would happen with raw sockets. ... I'm assuming you are using a raw TCP ... the packets aren't ACKed because ...
    (microsoft.public.win32.programmer.networks)
  • Re: Error in send, while using IP_HDRINCL
    ... > Arkady Frenkel wrote: ... >>> And MS could do exactly the same precautions for an app that uses raw ... >>> sockets. ...
    (microsoft.public.win32.programmer.networks)
  • Re: Error in send, while using IP_HDRINCL
    ... > Arkady Frenkel wrote: ... >>> And MS could do exactly the same precautions for an app that uses raw ... >> network students move to linux", at the end they leave the UDP ... BTW the Sudesh wrote that they can't read with raw sockets and that due to ...
    (microsoft.public.win32.programmer.networks)
  • Raw Socket Sender
    ... I must say I'm new to these Raw sockets in C# and unfortunantly I haven't met ... I set up my packet reciever which recieves RAW IP packets and dumps ... A blocking operation was interrupted by a call to ...
    (microsoft.public.dotnet.languages.csharp)