-
Notifications
You must be signed in to change notification settings - Fork 61
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Create ms_server_denial_of_service.py #10
Conversation
I used requests :-) sorry for that ) |
Hi! Thanks, this is great as always! As this is in the HTTP interface, I don't see a fit for having it available on Can you make this work using plain sockets instead of |
Hi Martin, We changed script but in testing time got HTTP request, from SAP Router, with package length like this can you say, how we can fix it (to router don't send packages with length of data)? thank you |
In order to the stream socket not append the NI layer you should use the
|
Hi Martin, from pysap.SAPRouter import SAPRoutedStreamSocket
route = '/H/yoursaprouter/S/3299'
host = 'desthttpmsgserver'
port = '8101'
conn = SAPRoutedStreamSocket.get_nisocket(host, port, route, talk_mode=1)
conn.send('ABCD')
conn.close() That will spit the following packet from the 'yoursaprouter' host:
As you can see the NI layer is still used (with length being prepended) |
I've got finally a working POC with: router = yoursaprouter
dest = desthttpmsgserver
destport = '8101'
router_sock = SAPNIStreamSocket.get_nisocket(router, 3299, keep_alive=True)
# Route description to our destination
router_string = [SAPRouterRouteHop(hostname=router, port=3299),
SAPRouterRouteHop(hostname=dest, port=destport)]
# Forge SAPRouter packet to enable the route
router_string_lens = list(map(len, list(map(str, router_string))))
p = SAPRouter(type=SAPRouter.SAPROUTER_ROUTE,
route_entries=len(router_string),
route_talk_mode=1,
route_rest_nodes=1,
route_length=sum(router_string_lens),
route_offset=router_string_lens[0],
route_string=router_string)
resp = router_sock.sr(p)
# And now send our raw TCP payload to final destination
router_sock.ins.send("ABCD") The important detail seems to be using the NB: My previous example after doing a pull didn't work anymore by spitting this:
|
About my last remark, I pointed out that |
Yes, I broke it in d2f0424! Fixing right now! |
Even when control text length is 0, the packet contains the eyecatcher string ("*ERR"). Pointed out by Mathieu Geli in #10! Thanks!
Raw talk mode was only implemented for receiving packets. Pointed out by Mathieu Geli in #10! Thanks!
Check it out and let me know how it goes now! Missed out that |
yeah that fixes everything, and simplifies the Router part of the POC as you advised ins issuecomment-280381063 |
Thanks man! Will check and merge ASAP! |
Find out that this approach doesn't work for non routed connections, as the NI layer is still added. I'm changing the behaviour of |
Can you check it's working fine without routing on the |
yes, without a route, I don't see the length field in the payload sent to the destination. c33e720 seems to work properly. ... ok with further testing I see incompatibilities:
Attempt to fix that issue (but hard to know what will be the consequences in others scenarios): diff --git a/pysap/SAPRouter.py b/pysap/SAPRouter.py
index 45e97fe..c492426 100644
--- a/pysap/SAPRouter.py
+++ b/pysap/SAPRouter.py
@@ -22,7 +22,7 @@ import re
import logging
from socket import error as SocketError
# External imports
-from scapy.layers.inet import TCP
+from scapy.layers.inet import TCP, Raw
from scapy.packet import Packet, bind_layers
from scapy.supersocket import socket, StreamSocket
from scapy.fields import (ByteField, ShortField, ConditionalField, StrField,
@@ -608,6 +608,7 @@ class SAPRoutedStreamSocket(SAPNIStreamSocket):
# need the NI layer anymore. Just use the plain socket inside the
# NIStreamSockets.
if self.routed and self.talk_mode == 1:
+ if not self.base_cls: self.basecls = Raw
return StreamSocket.recv(self)
# If the route was not accepted yet or we're working on non-native talk
# mode, we need the NI layer.
@@ -675,6 +676,7 @@ class SAPRoutedStreamSocket(SAPNIStreamSocket):
# NI layer completely
if talk_mode == 1:
sock = socket.create_connection((host, port))
+ if 'base_cls' in kwargs: kwargs.pop('base_cls')
return StreamSocket(sock, **kwargs)
# Otherwise use the standard SAPNIStreamSocket get_nisocket method |
I made my try by adapting your patch a little bit: if instead of pop'ing the base class we force it to be |
Merged in ab30711, thanks guys! |
Hi.
We found a DoS vulnerability in Message Server (all kernel versions)
May can you add functionality for SAP route in send_crash function?
I requested CVE and think will get for 24 hours.