projectdiscovery / wappalyzergo

A high performance go implementation of Wappalyzer Technology Detection Library
MIT License
674 stars 107 forks source link

Version regex is nill causing invalid memory address or nil pointer dereference #93

Closed LeDuySon closed 1 month ago

LeDuySon commented 1 month ago

Hi projectdiscovery team, thank you guys for the great tool. I want to report the issue that caused this error "invalid memory address or nil pointer dereference". I have debugged and figured out that the VersionRegex is Nil, the error happened in "github.com/projectdiscovery/wappalyzergo.(*VersionRegex).MatchString"

image

You guys can reproduce the error using below code!

package main

import (
    "fmt"
    "io"
    "log"
    "net/http"

    wappalyzer "github.com/projectdiscovery/wappalyzergo"
)

func main() {
    resp, err := http.DefaultClient.Get("https://samchicks.com")
    if err != nil {
        log.Fatal(err)
    }
    data, _ := io.ReadAll(resp.Body) // Ignoring error for example

    wappalyzerClient, err := wappalyzer.New()
    fingerprints := wappalyzerClient.Fingerprint(resp.Header, data)
    fmt.Printf("%v\n", fingerprints)

    // Output: map[Acquia Cloud Platform:{} Amazon EC2:{} Apache:{} Cloudflare:{} Drupal:{} PHP:{} Percona:{} React:{} Varnish:{}]
}
Ice3man543 commented 1 month ago

@LeDuySon I have linked #94 which solves the panic and adds improve handling for regexes etc

map[Bootstrap:{} Botble CMS:6.7.2:{} Google Analytics:{} Laravel:{} Nginx:1.18.0:{} Popper:{} Slick:{} Ubuntu:{} jQuery:{}]

Example Output above. Let me know if it solves the issue for you!