Jump to content

Spoof source address in a UDP packet (fsockopen)


soadlink

Recommended Posts

What would be the easiest/quickest way to spoof the source address of a UDP packet so it appears to be coming from somewhere else? Or if it was just possible to have an optional field for it like so:

 

$socket = fsockopen("udp://" . 'destinationip', 'destinationport', 'sourceip', 'sourceport', $err, $str, 10);

 

Probably wont be easy, but I just thought I'd ask to see if anyone knows a way if it's even feasible.

 

Also, I already tried posting in the core php hacking since I didn't find a way to do this with normal functions, but I was told it's the wrong thread, so here I am.

Link to comment
Share on other sites

  • 3 months later...
  • 3 months later...

You can't without changing the PHP core and the OS core, because the SYN flag can't be set by PHP, it's done internally. It's a security feature.

I think it's TCP that uses SYN not UDP. I'm pretty sure UDP is stateless.

 

 

Anyways if it can't be done by default in PHP, you could probably make an extension that will let you do that.

Link to comment
Share on other sites

Yep, definitely.  You could write a C extension to use raw sockets and construct whatever packets you wanted.  I was interpreting the original post as asking if there was already an extension to do it.  Though now that I read again, I think he was asking for ANY way.

 

While looking on google I noticed that perl has an extension for raw sockets, using the C functions.  Actually it's relevant here whether it's windows or linux .. given that this post is from february, i'm not expecting clarification from the original poster all that soon :)

Link to comment
Share on other sites

  • 6 months later...
This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.