Skip to main content


title: Ncrack category: scanner type: Authentication state: developing appVersion: '0.7' usecase: Network authentication bruteforcing custom_edit_url: >-

Ncrack is a high-speed network authentication cracking tool. It was built to help companies secure their networks by proactively testing all their hosts and networking devices for poor passwords. Security professionals also rely on Ncrack when auditing their clients. Ncrack was designed using a modular approach, a command-line syntax similar to Nmap and a dynamic engine that can adapt its behaviour based on network feedback. It allows for rapid, yet reliable large-scale auditing of multiple hosts.

To learn more about the Ncrack scanner itself visit Ncrack GitHub or Ncrack Website.

Ncrack Deployment & Configuration

Setup with custom files:

If you want to use your own files within the Ncrack scan, you have to create a secret first:

kubectl create secret generic --from-file users.txt --from-file passwords.txt ncrack-lists
IMPORTANT: Use an extra empty line at the end of your files, otherwise the last letter of the last line will be omitted (due to a bug in k8)

Now we created a secret named "ncrack-lists". Before we can use the files, we have to install the Ncrack ScanType:

cat <<EOF | helm install ncrack ./scanners/ncrack --values -
    - name: ncrack-lists
        secretName: ncrack-lists
    - name: ncrack-lists
      mountPath: "/ncrack/"

This enables us now to refer to our files via /ncrack/<file> in the scan.yaml.

For a full example on how to configure Ncrack with your custom files against a ssh service, see the "dummy-ssh" example.

Basic setup (no files can be mounted):

The Ncrack ScanType can be deployed via helm:

helm upgrade --install ncrack secureCodeBox/ncrack

Delete Ncrack ScanType:

helm delete ncrack

Scanner Configuration

The following security scan configuration example are based on the Ncrack Documentation, please take a look at the original documentation for more configuration examples.

This options summary is printed when Ncrack is run with no arguments. It helps people remember the most common options, but is no substitute for the in-depth documentation in the rest of this manual.

Ncrack 0.7 ( )
Usage: ncrack [Options] {target and service specification}
  Can pass hostnames, IP addresses, networks, etc.
  Ex:,,; 10.0.0-255.1-254
  -iX <inputfilename>: Input from Nmap's -oX XML output format
  -iN <inputfilename>: Input from Nmap's -oN Normal output format
  -iL <inputfilename>: Input from list of hosts/networks
  --exclude <host1[,host2][,host3],...>: Exclude hosts/networks
  --excludefile <exclude_file>: Exclude list from file
  Can pass target specific services in <service>://target (standard) notation or
  using -p which will be applied to all hosts in non-standard notation.
  Service arguments can be specified to be host-specific, type of service-specific
  (-m) or global (-g). Ex: ssh://,at=10,cl=30 -m ssh:at=50 -g cd=3000
  Ex2: ncrack -p ssh,ftp:3500,25,ssl
  -p <service-list>: services will be applied to all non-standard notation hosts
  -m <service>:<options>: options will be applied to all services of this type
  -g <options>: options will be applied to every service globally
  Misc options:
    ssl: enable SSL over this service
    path <name>: used in modules like HTTP ('=' needs escaping if used)
    db <name>: used in modules like MongoDB to specify the database
    domain <name>: used in modules like WinRM to specify the domain
  Options which take <time> are in seconds, unless you append 'ms'
  (miliseconds), 'm' (minutes), or 'h' (hours) to the value (e.g. 30m).
  Service-specific options:
    cl (min connection limit): minimum number of concurrent parallel connections
    CL (max connection limit): maximum number of concurrent parallel connections
    at (authentication tries): authentication attempts per connection
    cd (connection delay): delay <time> between each connection initiation
    cr (connection retries): caps number of service connection attempts
    to (time-out): maximum cracking <time> for service, regardless of success so far
  -T<0-5>: Set timing template (higher is faster)
  --connection-limit <number>: threshold for total concurrent connections
  --stealthy-linear: try credentials using only one connection against each specified host
    until you hit the same host again. Overrides all other timing options.
  -U <filename>: username file
  -P <filename>: password file
  --user <username_list>: comma-separated username list
  --pass <password_list>: comma-separated password list
  --passwords-first: Iterate password list for each username. Default is opposite.
  --pairwise: Choose usernames and passwords in pairs.
  -oN/-oX <file>: Output scan in normal and XML format, respectively, to the given filename.
  -oA <basename>: Output in the two major formats at once
  -v: Increase verbosity level (use twice or more for greater effect)
  -d[level]: Set or increase debugging level (Up to 10 is meaningful)
  --nsock-trace <level>: Set nsock trace level (Valid range: 0 - 10)
  --log-errors: Log errors/warnings to the normal-format output file
  --append-output: Append to rather than clobber specified output files
  --resume <file>: Continue previously saved session
  --save <file>: Save restoration file with specific filename
  -f: quit cracking service after one found credential
  -6: Enable IPv6 cracking
  -sL or --list: only list hosts and services
  --datadir <dirname>: Specify custom Ncrack data file location
  --proxy <type://proxy:port>: Make connections via socks4, 4a, http.
  -V: Print version number
  -h: Print this help summary page.
  SSH, RDP, FTP, Telnet, HTTP(S), Wordpress, POP3(S), IMAP, CVS, SMB, VNC, SIP, Redis, PostgreSQL, MQTT, MySQL, MSSQL, MongoDB, Cassandra, WinRM, OWA, DICOM
  ncrack -v --user root localhost:22
  ncrack -v -T5
  ncrack -v -iX ~/nmap.xml -g CL=5,to=1h

Password encryption

Because Ncrack findings are very sensitive, you probably don't want every secureCodeBox user to see them. In order to address this issue we provide an option that lets you encrypt found passwords with public key crypto. Just generate a key pair with openssl:

openssl genrsa -out key.pem 2048
openssl rsa -in key.pem -outform PEM -pubout -out public.pem

After you created the public key file you have to create a kubernetes secret from that file:

  kubectl create secret generic --from-file="public.key=public.pem" <ncrack-secret-name>

Now you only need to set the value encryptPasswords.existingSecret to the secrets name when installing the scanner

  helm install ncrack secureCodeBox/ncrack --set="encryptPasswords.existingSecret=<ncrack-secret-name>"

To decrypt a password from a finding use:

base64 encryptedPassword -d | openssl rsautl -decrypt -inkey key.pem -out decryptedPassword.txt

Chart Configuration

cascadingRules.enabledbooltrueEnables or disables the installation of the default cascading rules for this scanner
encryptPasswords.existingSecretstringnilsecret name with a pem encoded rsa public key to encrypt identified passwords
encryptPasswords.keystring"public.key"name of the property in the secret with the pem encoded rsa public key
parser.image.repositorystring""Parser image repository
parser.image.tagstringdefaults to the charts versionParser image tag
parser.ttlSecondsAfterFinishedstringnilseconds after which the kubernetes job for the parser will be deleted. Requires the Kubernetes TTLAfterFinished controller:
scanner.backoffLimitint3There are situations where you want to fail a scan Job after some amount of retries due to a logical error in configuration etc. To do so, set backoffLimit to specify the number of retries before considering a scan Job as failed. (see:
scanner.envlist[]Optional environment variables mapped into each scanJob (see:
scanner.extraContainerslist[]Optional additional Containers started with each scanJob (see:
scanner.extraVolumeMountslist[]Optional VolumeMounts mapped into each scanJob (see:
scanner.extraVolumeslist[]Optional Volumes mapped into each scanJob (see:
scanner.image.repositorystring""Container Image to run the scan
scanner.image.tagstringnildefaults to the charts appVersion
scanner.nameAppendstringnilappend a string to the default scantype name.
scanner.resourcesobject{}CPU/memory resource requests/limits (see:,
scanner.securityContextobject{}Optional securityContext set on scanner container (see:
scanner.ttlSecondsAfterFinishedstringnilseconds after which the kubernetes job for the scanner will be deleted. Requires the Kubernetes TTLAfterFinished controller:

๐Ÿ”ง The implementation is currently work-in-progress and still undergoing major changes. It'll be released here once it has stabilized.



In this example we execute an ncrack scan against the intentional vulnerable ssh service (dummy-ssh)

Initialize ncrack with lists and dummy-ssh

Before executing the scan, make sure to have dummy-ssh installed, and have the proper username & password lists:

# Create user & password list files, you can edit them later if you want
printf "root\nadmin\n" > users.txt
printf "THEPASSWORDYOUCREATED\n123456\npassword\n" > passwords.txt

# Create a Kubernetes secret containing these files
kubectl create secret generic --from-file users.txt --from-file passwords.txt ncrack-lists

# Install dummy-ssh app. We'll use ncrack to enumerate its ssh username and password
helm install dummy-ssh ./demo-targets/dummy-ssh/ --wait

# Install the ncrack scanType and set mount the files from the ncrack-lists Kubernetes secret
cat <<EOF | helm upgrade --install ncrack ./scanners/ncrack --values -
    - name: ncrack-lists
        secretName: ncrack-lists
    - name: ncrack-lists
      mountPath: "/ncrack/"

After that you can execute the scan in this directory:

kubectl apply -f scan.yaml

The scan should find credentials for username 'root' with password 'THEPASSWORDYOUCREATED'.


  • Make sure to leave a blank line at the end of each file used in the secret!
  • If printf doesn't create new lines, try 'echo -e "..."'
  • You can show your existing secrets with 'kubectl get secrets'
# SPDX-FileCopyrightText: 2020 iteratec GmbH
# SPDX-License-Identifier: Apache-2.0

apiVersion: ""
kind: Scan
  name: "dummy-ssh"
  scanType: "ncrack"
    # Enable verbose logging, d10: Debug Level 10, printing more output to the console
    - -v
    - -d10
    - -U
    - /ncrack/users.txt
    - -P
    - /ncrack/passwords.txt
    - ssh://dummy-ssh