|  | 
|  | 1 | +# Spring4Shell Detect | 
|  | 2 | + | 
|  | 3 | +WhiteSource spring4shell Detect is a free CLI tool that quickly scans your projects to find vulnerable Spring4shell versions | 
|  | 4 | +containing the following known CVEs: | 
|  | 5 | + | 
|  | 6 | +* CVE-2022-22963 | 
|  | 7 | +* CVE-2022-22965 | 
|  | 8 | + | 
|  | 9 | +It provides the exact path to direct and indirect dependencies, along with the fixed version for speedy remediation. | 
|  | 10 | + | 
|  | 11 | +The supported packages managers are: | 
|  | 12 | + | 
|  | 13 | +* gradle | 
|  | 14 | +* maven | 
|  | 15 | +* bundler | 
|  | 16 | + | 
|  | 17 | +In addition, the tool will search for vulnerable files with the `.jar`,`.gem` extensions. | 
|  | 18 | + | 
|  | 19 | +### Prerequisites: | 
|  | 20 | + | 
|  | 21 | +* Download the spring4shell-detect binary based on your OS platform (see installation steps below) | 
|  | 22 | + | 
|  | 23 | +--- | 
|  | 24 | +**NOTE** | 
|  | 25 | + | 
|  | 26 | +1. For mac users, if the following message appears: | 
|  | 27 | +   "spring4shell-detect can't be opened because Apple cannot check it for malicious software", please follow the steps | 
|  | 28 | +   [described here](https://support.apple.com/en-il/guide/mac-help/mchleab3a043/mac) | 
|  | 29 | + | 
|  | 30 | + | 
|  | 31 | +2. The relevant binaries must be installed for the scan to work, i.e: | 
|  | 32 | +    * `gradle` if the scanned project is a gradle project (contains a `settings.gradle` or a `build.gradle` file) | 
|  | 33 | +    * `mvn` if the scanned project is a maven project (contains a `pom.xml` file) | 
|  | 34 | +    * `ruby`/`jruby` and `gem`/`jgem` if the scanned project is a bundler project (contains a `Gemfile.lock`/`gems.locked` file) | 
|  | 35 | + | 
|  | 36 | + | 
|  | 37 | +3. Building the projects before scanning will improve scan time and reduce potential scan errors | 
|  | 38 | + | 
|  | 39 | +    * maven projects __must__ be built prior to scanning, e.g. with the following command: | 
|  | 40 | +       ```shell | 
|  | 41 | +       mvn install | 
|  | 42 | +       ``` | 
|  | 43 | + | 
|  | 44 | +    * bundler projects __must__ be built prior to scanning, e.g. with the following command: | 
|  | 45 | +       ```shell | 
|  | 46 | +       jbundler install | 
|  | 47 | +       ``` | 
|  | 48 | + | 
|  | 49 | +    * It is not necessary to run `gradle build` prior to scanning a `gradle` project, but that will greatly decrease the | 
|  | 50 | +      scan time | 
|  | 51 | + | 
|  | 52 | +--- | 
|  | 53 | + | 
|  | 54 | +## Usage | 
|  | 55 | + | 
|  | 56 | +In order to scan your project, simply run the following command: | 
|  | 57 | + | 
|  | 58 | +```shell | 
|  | 59 | +spring4shell-detect scan -d PROJECT_DIR | 
|  | 60 | +``` | 
|  | 61 | + | 
|  | 62 | +The folder can include source code that uses supported package managers in the project, as well binaries with the | 
|  | 63 | +supported extensions mentioned above. | 
|  | 64 | +It may error if it's run in a location which has protected folders it cannot access, such as Windows system folders. | 
|  | 65 | +
 | 
|  | 66 | +## Installation | 
|  | 67 | +
 | 
|  | 68 | +### Linux | 
|  | 69 | +
 | 
|  | 70 | +```shell | 
|  | 71 | +ARCH=amd64 # or ARCH=arm64 | 
|  | 72 | +wget "https://github.com/whitesource/spring4shell-detect/releases/latest/download/spring4shell-detect-1.0.0-linux-$ARCH.tar.gz" | 
|  | 73 | +tar -xzvf spring4shell-detect-1.0.0-linux-$ARCH.tar.gz | 
|  | 74 | +chmod +x spring4shell-detect | 
|  | 75 | +./spring4shell-detect -h | 
|  | 76 | +``` | 
|  | 77 | +
 | 
|  | 78 | +### Mac | 
|  | 79 | +
 | 
|  | 80 | +```shell | 
|  | 81 | +ARCH=amd64 # or ARCH=arm64  | 
|  | 82 | +wget "https://github.com/whitesource/spring4shell-detect/releases/latest/download/spring4shell-detect-1.0.0-darwin-$ARCH.tar.gz" | 
|  | 83 | +tar -xzvf spring4shell-detect-1.0.0-darwin-$ARCH.tar.gz | 
|  | 84 | +chmod +x spring4shell-detect | 
|  | 85 | +./spring4shell-detect -h | 
|  | 86 | +``` | 
|  | 87 | +
 | 
|  | 88 | +### Windows | 
|  | 89 | +
 | 
|  | 90 | +```powershell | 
|  | 91 | +Invoke-WebRequest -Uri "https://github.com/whitesource/spring4shell-detect/releases/latest/download/spring4shell-detect-1.0.0-windows-amd64.zip" -OutFile "spring4shell-detect.zip" | 
|  | 92 | +Expand-Archive -LiteralPath 'spring4shell-detect.zip' | 
|  | 93 | +cd spring4shell-detect | 
|  | 94 | +.\spring4shell-detect.exe -h | 
|  | 95 | +``` | 
0 commit comments