如何使用Noir從源代碼檢測(cè)攻擊面
關(guān)于Noir
Noir是一款功能強(qiáng)大的代碼安全檢測(cè)工具,在該工具的幫助下,廣大研究人員能夠輕松從源代碼層面檢測(cè)目標(biāo)應(yīng)用程序的潛在攻擊面。
功能介紹
1、從源代碼自動(dòng)識(shí)別編程語(yǔ)言和框架;
2、通過(guò)代碼分析查找API終端節(jié)點(diǎn)和網(wǎng)站頁(yè)面;
3、通過(guò)與ZAP、Burpsuite、Caido和More proxy工具等代理工具的交互,快速加載分析結(jié)果;
4、支持為已成功識(shí)別的攻擊面提供結(jié)構(gòu)化結(jié)果數(shù)據(jù),例如JSON和HAR等,以實(shí)現(xiàn)與其他工具的無(wú)縫交互;
5、提供了命令行使用樣例,以便輕松地與其他工具(如curls或httpie)集成和協(xié)作;
工具支持的可用范圍
終端節(jié)點(diǎn)實(shí)體
1、路徑Path
2、方法Method
3、參數(shù)Param
4、網(wǎng)站頭Header
5、協(xié)議Protocol(例如ws)
語(yǔ)言和框架
語(yǔ)言  | 框架  | URL  | Method  | Param  | Header  | WS  | 
Go  | Echo  | ?  | ?  | ?  | ?  | X  | 
Go  | Gin  | ?  | ?  | ?  | ?  | X  | 
Python  | Django  | ?  | X  | X  | X  | X  | 
Python  | Flask  | ?  | X  | X  | X  | X  | 
Ruby  | Rails  | ?  | ?  | ?  | ?  | X  | 
Ruby  | Sinatra  | ?  | ?  | ?  | ?  | X  | 
Php  | ?  | ?  | ?  | ?  | X  | |
Java  | Spring  | ?  | ?  | X  | X  | X  | 
Java  | Jsp  | ?  | ?  | ?  | X  | X  | 
Crystal  | Kemal  | ?  | ?  | ?  | ?  | ?  | 
JS  | Express  | ?  | ?  | X  | X  | X  | 
JS  | Next  | X  | X  | X  | X  | X  | 
規(guī)范標(biāo)準(zhǔn)
規(guī)范  | 格式  | URL  | Method  | Param  | Header  | WS  | 
OAS 2.0 (Swagger 2.0)  | JSON  | ?  | ?  | ?  | ?  | X  | 
OAS 2.0 (Swagger 2.0)  | YAML  | ?  | ?  | ?  | ?  | X  | 
OAS 3.0  | JSON  | ?  | ?  | ?  | ?  | X  | 
OAS 3.0  | YAML  | ?  | ?  | ?  | ?  | X  | 
RAML  | YAML  | ?  | ?  | ?  | ?  | X  | 
工具安裝
由于該工具基于Crystal開(kāi)發(fā),因此我們首先需要在本地設(shè)備上裝并配置好Crystal開(kāi)發(fā)環(huán)境。
源碼安裝
首先,我們需要訪問(wèn)下列地址安裝Crystal-lang:
https://crystal-lang.org/install/接下來(lái),廣大研究人員可以使用下列命令將該項(xiàng)目源碼克隆至本地:
git clone https://github.com/hahwul/noir然后切換到項(xiàng)目目錄中,并安裝工具所需其他依賴(lài)組件:
cd noir
shards install依賴(lài)組件安裝完成后,我們需要對(duì)代碼進(jìn)行構(gòu)建:
shards build --release --no-debug最后,將構(gòu)建生成后的代碼拷貝到指定路徑即可:
cp ./bin/noir /usr/bin/Docker安裝(GHCR)
docker pull ghcr.io/hahwul/noir:mainHomebrew安裝(macOS)
brew tap hahwul/noir
brew install noir工具使用幫助
Usage: noir <flags>
  Basic:
    -b PATH, --base-path ./app       設(shè)置基路徑(必須)
    -u URL, --url http://..             設(shè)置終端節(jié)點(diǎn)基地址URL
    -s SCOPE, --scope url,param      設(shè)置檢測(cè)范圍
 
  Output:
    -f FORMAT, --format json  設(shè)置輸出格式,包括[plain/json/markdown-table/curl/httpie]
    -o PATH, --output out.txt         將結(jié)果寫(xiě)入到文件中
    --set-pvalue VALUE              給已識(shí)別參數(shù)指定值
    --no-color                       禁用顏色高亮輸出
    --no-log                         僅顯示結(jié)果
 
  Deliver:
    --send-req                       將結(jié)果發(fā)送至Web請(qǐng)求
    --send-proxy http://proxy..      通過(guò)HTTP代理將結(jié)果發(fā)送至Web請(qǐng)求
 
  Technologies:
    -t TECHS, --techs rails,php      設(shè)置要使用的技術(shù)
    --exclude-techs rails,php        指定需要排除的技術(shù)
    --list-techs                     顯示所有技術(shù)(列表)
 
  Others:
    -d, --debug                      顯示調(diào)試信息
    -v, --version                     顯示工具版本
    -h, --help                        顯示工具幫助信息工具使用樣例
noir -b . -u https://testapp.internal.domains
JSON結(jié)果
noir -b . -u https://testapp.internal.domains -f json[
  ...
  {
    "headers": [],
    "method": "POST",
    "params": [
      {
        "name": "article_slug",
        "param_type": "json",
        "value": ""
      },
      {
        "name": "title",
        "param_type": "json",
        "value": ""
      },
      {
        "name": "id",
        "param_type": "json",
        "value": ""
      }
    ],
    "protocol": "http",
    "url": "https://testapp.internal.domains/comments"
  }
]許可證協(xié)議
本項(xiàng)目的開(kāi)發(fā)與發(fā)布遵循MIT開(kāi)源許可證協(xié)議。
項(xiàng)目地址
Noir:【GitHub傳送門(mén)】
參考資料
https://crystal-lang.org/install/
本文作者:Alpha_h4ck, 轉(zhuǎn)載請(qǐng)注明來(lái)自FreeBuf.COM















 
 
 











 
 
 
 