Skip to content
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

Nikto created invalid JSON #855

Open
JaneX8 opened this issue Jan 20, 2025 · 0 comments
Open

Nikto created invalid JSON #855

JaneX8 opened this issue Jan 20, 2025 · 0 comments

Comments

@JaneX8
Copy link

JaneX8 commented Jan 20, 2025

I'm running master but this is still an issue. A snippet:

[{

    "id": "999962",

    "method": "GET",

    "url": "/",

    "msg": ": Server banner changed from 'Microsoft-Azure-Application-Gateway/v2' to 'Microsoft-IIS/10.0'."

} {

    "host": "xxx",

    "ip": "xxx",

    "port": "443",

    "banner": "",

    "vulnerabilities": [\, {

        "id": "999986",

        "method": "GET",

        "url": "/",

        "msg": "Retrieved x-powered-by header: ASP.NET."

    }

The issue is }{ and :[\,{.

git tag -n

2.1.6           Merge pull request #268 from RealRancor/six_cms

2.5.0           Ran tidy for #727



git branch

* master



git show summary

commit b7233c38605b7d95084f661b071bc0cfd233dbc6 (HEAD -> master, origin/master, origin/HEAD)

Author: Sullo <[email protected]>

Date:   Fri Nov 15 16:31:52 2024 -0500



    Add some Azure App Service headers

I scan with these parameters:


/apps/nikto/program/nikto.pl -host example.com -port 443 -ipv4 -Cgidirs none -maxtime 240 -timeout 3 -ask auto -nointeractive -no404 --Format json -output "/tmp/somefile.json".



Lastly, the target I scanned has two redirects:

1. A HTML-metadata refresh redirect from https://a.example.com to https://b.example.com 

2. A HTTP 302 redirect from https://b.example.com to https://b.example.com/login

My temporary quick and dirty fix for now:

    function validate_json() {

        jq empty "$1" >/dev/null 2>&1

    }



            if [ -f "$FILE" ]; then

              if ! validate_json "$FILE"; then

                    echo "$FILE contains invalid JSON. Attempting to fix."

                        # Replace occurrences of `}{` with `},{`

                        sed -i 's:}{:},{:g' "$FILE"

                        # Replace occurrences of `[,` with `[`

                        sed -i 's:\[,:\[:g' "$FILE"

                fi

                if ! validate_json "$FILE"; then

                    echo "Fix failed. $FILE still contains invalid JSON."

                    mv "$FILE" "${FILE%.json}.json-corrupt"

                fi

            fi

Also, finding 999962 is placed in the root of the [] instead of in vulnerabilities (I fix that with jq now):

[{

    "id": "999962",

    "method": "GET",

    "url": "/",

    "msg": ": Server banner changed from 'Microsoft-Azure-Application-Gateway/v2' to 'Microsoft-IIS/10.0'."

}, {

    "host": "xxx",

    "ip": "xxx",

    "port": "443",

    "banner": "",

    "vulnerabilities": [{

Originally posted by @JaneX8 in #599

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant