搜索
查看: 270|回复: 0

How To Decode BIG IP F5 Persistence Cookie Values

[复制链接]

1839

主题

2255

帖子

1万

积分

管理员

Rank: 9Rank: 9Rank: 9

积分
11913
发表于 2017-6-16 09:55:46 | 显示全部楼层 |阅读模式
Hey Guys,
I came across a BIG IP F5 Load balancer when doing a recent web application penetration test. The interesting thing about this load balancer was the cookie value:
  1. Name BIGipServerLive_pool
  2. Value 110536896.20480.0000
  3. Path /
  4. Secure No
  5. Expires At End Of Session</span>
复制代码
As you can see the cookie value looks rather suspicious, lets see if we can reverse it! I came across the following page with a plethora of information regarding this particular cookie, it is well worth a read:
After reading that it was quite clear to me that the cookie value was an encoded IP and Port value. I wrote a quick Python script to help me decode the cookie value as the ones I found on the net were poorly written and didn’t work. Here is the code and an example run:
  1. #!/usr/bin/env python

  2. # example string: 110536896.20480.0000

  3. import struct
  4. import sys

  5. if len(sys.argv) != 2:
  6.         print "Usage: %s encoded_string" % sys.argv[0]
  7.         exit(1)

  8. encoded_string = sys.argv[1]
  9. print "\n[*] String to decode: %s\n" % encoded_string

  10. (host, port, end) = encoded_string.split('.')

  11. (a, b, c, d) = [ord(i) for i in struct.pack("<I", int(host))]


  12. print "[*] Decoded IP: %s.%s.%s.%s.\n" % (a,b,c,d)
复制代码
Then when you run the program:
  1. root@bt:~/bigip# python bigip.py 110536896.20480.0000

  2. [*] String to decode: 110536896.20480.0000

  3. [*] Decoded IP: 192.168.150.6.

  4. root@bt:~/bigip#
复制代码
Hopefully this will come in handy for someone out there
*** Update:  I have amended the code to allow for decoding of the port:
  1. #!/usr/bin/env python

  2. # example string: 110536896.20480.0000

  3. import struct
  4. import sys

  5. if len(sys.argv) != 2:
  6. print "Usage: %s encoded_string" % sys.argv[0]
  7. exit(1)

  8. encoded_string = sys.argv[1]
  9. print "\n[*] String to decode: %s\n" % encoded_string

  10. (host, port, end) = encoded_string.split('.')

  11. (a, b, c, d) = [ord(i) for i in struct.pack("<I", int(host))]

  12. (e) = [ord(e) for e in struct.pack("<H", int(port))]
  13. port = "0x%02X%02X" % (e[0],e[1])

  14. print "[*] Decoded Host and Port: %s.%s.%s.%s:%s\n" % (a,b,c,d, int(port,16))
复制代码
Example run:
  1. dusty@HackBox:~$ python BigIPF5-Decoder.py 185903296.21520.0000

  2. [*] String to decode: 185903296.21520.0000

  3. [*] Decoded Host and Port: 192.168.20.11:4180

  4. dusty@HackBox:~
复制代码

过段时间可能会取消签到功能了
您需要登录后才可以回帖 登录 | Join BUC

本版积分规则

Powered by Discuz!

© 2012-2015 Baiker Union of China.

快速回复 返回顶部 返回列表