這篇文章給大家分享的是有關Nautilus是一款什么工具的內容。小編覺得挺實用的,因此分享給大家做個參考,一起跟隨小編過來看看吧。
Nautilus是一款基于覆蓋指引和語法的反饋式模糊測試工具,廣大研究人員可以使用Nautilus來提升模糊測試過程中的測試覆蓋率,以尋找到更多的安全漏洞。在Nautilus的幫助下,研究人員可以通過指定半有效的輸入語法,來執行更加復雜的變異操作,并生成更多有效的測試用例。
目前,Nautilus已發布了2.0版本,該版本相較于Nautilus原型,引入了很多功能性提升,目前該工具已經100%支持AFL++了。除了穩定性和可用性提升之外,還包括下列功能提升:
支持AFL-Qemu模式
支持Python格式語法
支持使用Python腳本生成結構化輸入
支持指定源碼協議/格式
支持指定正則表達式
避免生成相似的短輸入
提供了更好的錯誤輸出
修復大量Bug
我們可以使用類似EXPR -> EXPR + EXPR、EXPR -> NUM和NUM -> 1這樣的規則來指定一個語法。針對這些規則,模糊測試器將構建一個樹狀結構,這種內部語法表達允許支持更加復雜的變異操作。接下來,這個樹狀結構將會轉變為針對目標應用程序的真實輸入,即拼接所有的葉子節點。在下方給出的示例中,左子樹將會被解析為“a=1+2”,右子樹則為“a=1+1+1+2”。為了提高語法的表達能力,Nautilus還可以允許廣大研究人員使用Python腳本來實現對樹狀結構的解析,以支持更加復雜的操作。
首先,廣大用戶需要使用下列命令將該項目源碼克隆至本地,并進行基礎配置:
git clone 'git@github.com:nautilus-fuzz/nautilus.git' cd nautilus /path/to/AFLplusplus/afl-clang-fast test.c -o test #afl-clang-fast as provided by AFL
接下來,我們需要在config.ron文件中設置好所有需要使用的參數:
cargo run --release -- -g grammars/grammar_py_example.py -o /tmp/workdir -- ./test @@
如果想要使用QEMU模式的話,可以運行下列命令:
cargo run /path/to/AFLplusplus/afl-qemu-trace -- ./test_bin @@
在這里,我們可以使用Python來生成一個語法,并生成一個有效的類XML輸入。需要注意的是,Python腳本的語法規則,這里必須確保匹配起始標簽:
#ctx.rule(NONTERM: string, RHS: string|bytes) adds a rule NONTERM->RHS. We can use {NONTERM} in the RHS to request a recursion. ctx.rule("START","<document>{XML_CONTENT}</document>") ctx.rule("XML_CONTENT","{XML}{XML_CONTENT}") ctx.rule("XML_CONTENT","") #ctx.script(NONTERM:string, RHS: [string]], func) adds a rule NONTERM->func(*RHS). # In contrast to normal `rule`, RHS is an array of nonterminals. # It's up to the function to combine the values returned for the NONTERMINALS with any fixed content used. ctx.script("XML",["TAG","ATTR","XML_CONTENT"], lambda tag,attr,body: b"<%s %s>%s</%s>"%(tag,attr,body,tag) ) ctx.rule("ATTR","foo=bar") ctx.rule("TAG","some_tag") ctx.rule("TAG","other_tag") #sometimes we don't want to explore the set of possible inputs in more detail. For example, if we fuzz a script #interpreter, we don't want to spend time on fuzzing all different variable names. In such cases we can use Regex #terminals. Regex terminals are only mutated during generation, but not during normal mutation stages, saving a lot of time. #The fuzzer still explores different values for the regex, but it won't be able to learn interesting values incrementally. #Use this when incremantal exploration would most likely waste time. ctx.regex("TAG","[a-z]+")
接下來,我們可以使用模糊測試用例生成器來測試我們剛才生成的語法:
$ cargo run --bin generator -- -g grammars/grammar_py_exmaple.py -t 100 <document><some_tag foo=bar><other_tag foo=bar><other_tag foo=bar><some_tag foo=bar></some_tag></other_tag><some_tag foo=bar><other_tag foo=bar></other_tag></some_tag><other_tag foo=bar></other_tag><some_tag foo=bar></some_tag></other_tag><other_tag foo=bar></other_tag><some_tag foo=bar></some_tag></some_tag></document>
除此之外,我們還可以結合AFL來使用Nautilus。使用“-o”參數來指向AFL到同一工作目錄,而AFL則會將數據跟Nautilus同步。在這里,AFL將導入Nautilus的輸入:
#Terminal/Screen 1 ./afl-fuzz -Safl -i /tmp/seeds -o /tmp/workdir/ ./test @@ #Terminal/Screen 2 cargo run --release -- -o /tmp/workdir -- ./test @@
感謝各位的閱讀!關于“Nautilus是一款什么工具”這篇文章就分享到這里了,希望以上內容可以對大家有一定的幫助,讓大家可以學到更多知識,如果覺得文章不錯,可以把它分享出去讓更多的人看到吧!
免責聲明:本站發布的內容(圖片、視頻和文字)以原創、轉載和分享為主,文章觀點不代表本網站立場,如果涉及侵權請聯系站長郵箱:is@yisu.com進行舉報,并提供相關證據,一經查實,將立刻刪除涉嫌侵權內容。