Bash script to check if you have a SIP profile attached to a Virtual Server (CVE-2023-22842)

Code is community submitted, community supported, and recognized as ‘Use At Your Own Risk’.

Short Description

Generate a CSV report to know which virtual servers have a SIP profile attached.

Problem solved by this Code Snippet

This is to shorten the time to investigate for CVE-2023-22842 for example.

How to use this Code Snippet

  1. On bash prompt:
    # vi sip_profile.sh

  2. Paste the script (see and copy below)

  3. Save the file :wq!

  4. change permission
    # chmod 777 sip_profile.sh

  5. Run the script:
    # ./sip_profile.sh

  6. The output will be a CSV file under /var/tmp/sip-mapped-to-virtuals-output.csv

  7. To check the output:

    [admin@bigip:Active:Standalone] ~ # cat /var/tmp/sip-mapped-to-virtuals-output.csv<br>Virtual Server, SIP Profile<br>VS_SIP,sip<br>VS_MRP,sip_mrp<strong><br></strong>
    

Code Snippet Meta Information

Full Code Snippet

#!/bin/bash<br>echo "Virtual Server, SIP Profile" > /var/tmp/sip_profile_map_to_virtual.csv<br>profile_names=`tmsh list ltm profile sip one-line | awk -F" " '{print $4}'`<br>for x in ${profile_names}<br>do<br>virtual_name=`tmsh list ltm virtual one-line | grep -w $x | awk -F" " '{print $3}'`<br>if [ "${virtual_name}" != "" ]<br>then<br>for y in ${virtual_name}<br>do<br>echo "$y,$x" >> /var/tmp/sip_profile_map_to_virtual.csv<br>done<br>fi<br>done
2 Likes

Thanks  @michelangelodorado  - I haven’t heard that this got any love.
Pretty tidy little script.

Here is a similar result done in two commands from the bash shell that will scan all partitions and include results from iApps and FAST as well. This simply returns the virtual server name for every virtual that has a SIP profile associated with it to the terminal.

PROFILES=$(tmsh -c 'cd /; list ltm profile sip recursive one-line' | awk '{ print  $4}' | tr '\n' '|' | sed '$s/.$/\n/')
tmsh -c 'cd /; list ltm virtual recursive one-line' | grep -E "($PROFILES)" | awk '{print "/" $3}'