Issue when trying to send and receive data before fuzzing

119 views
Skip to first unread message

I C

unread,
Dec 11, 2020, 12:05:31 PM12/11/20
to boofuzz
Hello,

For the protocol I'm fuzzing, I need to retrieve a session handle which will be reused in the fuzzed requests.

I first tried to use pre_send with the following code:

...

but I don't see my request being sent during the fuzzing.

After that, I tried to use pre_send_callbacks method in the session.
Now I see my request but I didn't find how to use the answer in the fuzzed request.
In the example with callback I've seen, node and edge are passed to the callback function and they can be used to replace part of the request before sending.
However, when I try to pass node and edge to my pre_send_callbacks method, I get this error:


Is there a way to do what I want with pre_send or pre_send_callbacks ?
Or another solution entirely ?

Thank you

I C

unread,
Dec 11, 2020, 1:36:03 PM12/11/20
to boofuzz
it looks like the image I attached were removed so I'll add the code here.
For my attempt using pre_send:

def register_session2(target, fuzz_data_logger, session):
    #register session
    Command = 0x0065
    Length = 0x04
    SessionHandle = 0x00000000
    Status = 0x00000000
    SenderContext = 0x0000000000000000
    Options = 0x00000000
    ProtocolVersion = 0x0001
    OptionFlags = 0x0000
    RegisterSessionReq = struct.pack('<hhiiqihh' , Command, Length, SessionHandle, Status, SenderContext, Options, ProtocolVersion, OptionFlags)
    target.send(RegisterSessionReq)
    RegisterSessionRsp = target.recv(10000)
    SessionHandle = RegisterSessionRsp[4:8]

...
session.pre_send = register_session2
session.connect(s_get("Get Attribute"))  

session.fuzz()

and for the attempt using pre_send_callbacks:
def register_session(target, fuzz_data_logger, session, node, edge, *args, **kwargs):
    #register session
    Command = 0x0065
    Length = 0x04
    SessionHandle = 0x00000000
    Status = 0x00000000
    SenderContext = 0x0000000000000000
    Options = 0x00000000
    ProtocolVersion = 0x0001
    OptionFlags = 0x0000
    RegisterSessionReq = struct.pack('<hhiiqihh' , Command, Length, SessionHandle, Status, SenderContext, Options, ProtocolVersion, OptionFlags)
    target.send(RegisterSessionReq)
    RegisterSessionRsp = target.recv(10000)
    SessionHandle = RegisterSessionRsp[4:8]

error is:
Error!!!! A custom pre_send callback function raised an uncought error.
Traceback (most recent call last):
  File "C:\Program Files\Python38\lib\site-packages\boofuzz\monitors\callback_monitor.py", line 44, in pre_send
    f(target=target, fuzz_data_logger=fuzz_data_logger, session=session, sock=target)
TypeError: register_session() missing 2 required positional arguments: 'node' and 'edge'

if I remove node and edge from the parameters of the pre_callback function, my pre-request is sent but I'm not able to use the results in the nodes.


joshua.t...@gmail.com

unread,
Jan 9, 2021, 3:16:59 PM1/9/21
to boofuzz
Hello! From what you've described, it's hard to debug with precision. However, it looks like you can get the data successfully, in which case you might just store it in a global variable, which you then use in the node-specific callback method.
Reply all
Reply to author
Forward
0 new messages