Forum Discussion

Nat_Thirasuttakorn's avatar
Nov 09, 2004

HTTP::payload vs Null/binary insertion

Hi all,

 

 

I have try to insert binary data into HTTP payload by "HTTP::payload replace" command but it insert not as I expected.

 

 

for example:-

 

HTTP::payload replace offset 0 [binary format "B8B8" 00000000 10010110]

 

HTTP::payload replace [HTTP::header "Content-Length"] 0 "\000\226"

 

 

it inserted [C0 80 C2 96] instead of [00 96]

 

 

anyone could tell me the right way to insert/replace binary and Null character in HTTP (TCP/UDP) payload.

 

 

Note: If i insert the binary character into bigip.conf directly by hex editor or command like "printf" it works (except Null).

 

 

Thanks in advance

 

 

Best regards,

 

Nat

 

 

 

  • unRuleY_95363's avatar
    unRuleY_95363
    Historic F5 Account
    I believe this is a Utf problem.

     

     

    [C0 80] is the Utf equivalent to Null.

     

     

    I need to check into this a bit and get back to you.
  • bl0ndie_127134's avatar
    bl0ndie_127134
    Historic F5 Account
    Looks like you have found a problem with the payload command. What's happening is that the binary data outside the value of 1 and 127 is being expanded into 2 byte UTF form when its marshalled into BigIP. We are looking into this problem (CR42507) and we should have a fix available with BigIP 9.03.
  • I have tested with new hotfix for 9.0.2. (regarding solution SOL3594 and SOL3602)

     

    The [HTTP::payload replace] command does work for binary data like \001, \002, etc, but still does not work with NULL or \000.

     

     

    am I doing something wrong? has any one successfully insert null by HTTP::payload replace command after apply this hotfix.

     

     

    Thanks in advance
  • unRuleY_95363's avatar
    unRuleY_95363
    Historic F5 Account
    Please try this out and let us know:

     

     

    HTTP::payload replace offset 0 [binary format ca* 0 "my goofy string"]

     

     

    FYI, the problem is that the literal string is converted to Utf-8 when Tcl compiles the rule. This changes any embedded NUL's to C0 80 in the string. Therefore, you still need to use the binary format command to convert from the Utf-8 encoded literal string into a binary array (this is what keeps HTTP::payload replace offset 0 "\000my goofy string" from working).

     

     

    There is also a known issue with the binary format command that will prevent just using a* from working correctly (ie, binary format a* "\000my goofy string") This has been fixed in the upcoming 9.0.3 release.

     

     

    Thanks Nat!