AFL - News, Videos, Fixtures, Scores & Results - AFL.com.au
Skip to main content
AFL
AFLW
AFL Play
Club Sites
Adelaide Crows
Adelaide Crows
Brisbane
Brisbane
Carlton
Carlton
Collingwood
Collingwood
Essendon
Essendon
Fremantle
Fremantle
Geelong
Geelong
Gold Coast Suns
Gold Coast Suns
GWS Giants
GWS Giants
Hawthorn
Hawthorn
Melbourne
Melbourne
North Melbourne
North Melbourne
Port Adelaide
Port Adelaide
Richmond
Richmond
St Kilda
St Kilda
Sydney Swans
Sydney Swans
West Coast Eagles
West Coast Eagles
Western Bulldogs
Western Bulldogs
Created by Telstra
More from Telstra
Australia's best network.
AFL Tipping
AFL Fantasy
Telstra
Telstra TV
Telstra TV Box Office
Foxtel From Telstra
AFL Logo
Latest
News
Videos
Podcasts
Gallery
Matches
Fixture
Ladder
Teams
Broadcast Guide
Match Videos
Stats
AFL Stats
Team Rankings
Premiership Winners
Brownlow Medal
Leaders & Awards
AFL On Demand
Tickets
Buy Tickets
On-Sale Dates
FAQ
Venues
Membership
Fantasy
Play AFL Fantasy
Fantasy Hub
Fantasy Draft
Tipping
Shop
AFL Logo
Menu
Video
Match Centre
Ladder
Stats
Latest
News
Videos
Podcasts
Gallery
Matches
Fixture
Ladder
Teams
Broadcast Guide
Match Videos
Stats
AFL Stats
Team Rankings
Premiership Winners
Brownlow Medal
Leaders & Awards
AFL On Demand
Tickets
Buy Tickets
On-Sale Dates
FAQ
Venues
Membership
Fantasy
Play AFL Fantasy
Fantasy Hub
Fantasy Draft
Tipping
Shop
VFL/VFLW
SANFL
WAFL
AFLW
PLAY AFL
About AFL
VFL/VFLW hub
SANFL hub
WAFL hub
Trade
Draft
Toyota AFL Club Help
Competitions & Promotions
Concussion
Mental Health & Wellbeing
Diversity & Inclusion
AFL Mint
Marvel Stadium
AFL Policies
Annual Reports
Careers
Contact Us
Clubs
Adelaide Crows
Adelaide Crows
Brisbane
Brisbane
Carlton
Carlton
Collingwood
Collingwood
Essendon
Essendon
Fremantle
Fremantle
Geelong
Geelong
Gold Coast Suns
Gold Coast Suns
GWS Giants
GWS Giants
Hawthorn
Hawthorn
Melbourne
Melbourne
North Melbourne
North Melbourne
Port Adelaide
Port Adelaide
Richmond
Richmond
St Kilda
St Kilda
Sydney Swans
Sydney Swans
West Coast Eagles
West Coast Eagles
Western Bulldogs
Western Bulldogs
VFL/VFLW
SANFL
WAFL
AFLW
PLAY AFL
About AFL
VFL/VFLW hub
SANFL hub
WAFL hub
Trade
Draft
Toyota AFL Club Help
Competitions & Promotions
Concussion
Mental Health & Wellbeing
Diversity & Inclusion
AFL Mint
Marvel Stadium
AFL Policies
Annual Reports
Careers
Contact Us
Clubs
Adelaide Crows
Adelaide Crows
Brisbane
Brisbane
Carlton
Carlton
Collingwood
Collingwood
Essendon
Essendon
Fremantle
Fremantle
Geelong
Geelong
Gold Coast Suns
Gold Coast Suns
GWS Giants
GWS Giants
Hawthorn
Hawthorn
Melbourne
Melbourne
North Melbourne
North Melbourne
Port Adelaide
Port Adelaide
Richmond
Richmond
St Kilda
St Kilda
Sydney Swans
Sydney Swans
West Coast Eagles
West Coast Eagles
Western Bulldogs
Western Bulldogs
Follow us on social media
Youtube
TikTok
00:54
Half-time disaster with gun Lion helped off the field
Brisbane suffers a huge blow with rebounding defender Keidean Coleman going down with a suspected leg injury
AFL
Follow it LIVE: Final teams, subs locked in for Lions-Blues
Follow the live coverage from the Opening Round clash between the Lions and Blues
AFL
Clarkson cops big fine for 'unacceptable' Saints outburst
North Melbourne coach Alastair Clarkson has been punished by the AFL for his 'highly inappropriate' comments to St Kilda players
AFL
09:02
Footy Feed: Terrific Tiger tale, Pie who's stiff, Blue's back
Sarah Olle and Josh Gabelich unpack the Opening Round teams
AFL
More News
All News
AFL
Video
Footy Feed: Terrific Tiger tale, Pie who's stiff, Blue's back
Opinion
AFL
opinion
IF the Cats get on a roll in 2024 ... THEN
AFL
Star Dog to push R1 case in VFL, ex-Saint in line for AFL comeback
AFLW
'That's what I thrive on': Why Hyett answered the coaching call
AFL
Hot streak: Lion's insane record stretches to 26 games
AFL
Prelim heartbreak lingers, but Giants have eyes on the Pies
AFL
Suns brace for growing pains under new coach Hardwick
AFL
podcasts
LISTEN: Same old Dees, Nat reflects on International Women's Day
AFL
Rowell on new look, role and why Opening Round is critical
AFLW
Video
The new norm: Hyett sees bright future for female coaches
AFL
match report
Grundy gets last laugh as Swans roll Dees at packed SCG
AFL
TEAMS: Blues gun returns, Lions mid out, young Pie missing
AFL
The off-season change that has Cats defender approaching his 'peak'
AFL
'His second half was huge': Gun recruit stars against old mates
AFL
'I put a mask on': Tim Membrey on his mental health battle
AFL
Bombers trio to play VFL ahead of season opener
AFL
'I lost trust in my body': Eagles star puts injury-riddled years behind him
Opinion
AFL
Opening Round preview: Old rivalries reignite, teams out for revenge
AFL
Errol Gulden on Johnny Drama, Brownlow nerves and THAT song
Opinion
AFL
Expert predictions: Damo's surprise Cats call, Cal's bold Port tip
Quick Links
AFL
AFLW
VFL
VFLW
SANFL
WAFL
PLAY AFL
Previous
Next
Team Lineups
New Today
AFL Tipping
Now open for 2024
Latest injury news
New Today
Opening Round 2024
Gather Round
New Today
See every matchup for the upcoming season
All your latest draft news
New Today
Each weekday from 7.30am AEDT
AFL Play
Get the AFL Newsletter
New Today
Turn it on
Videos
Featured
Latest
AFL
AFLW
Footy Feed
Fantasy
Learn More
Footy Feed: Terrific Tiger tale, Pie who's stiff, Blue's back
Sarah Olle and Josh Gabelich unpack the Opening Round teams
AFL
09:02
Footy Feed: Terrific Tiger tale, Pie who's stiff, Blue's back
Sarah Olle and Josh Gabelich unpack the Opening Round teams
AFL
06:20
Highlights: Sydney v Melbourne
The Swans and Demons clash in Opening Round
AFL
01:50
Grundy gets the points against former allies
Brodie Grundy shines in his first outing for Sydney, winning the battle against ex-teammate Max Gawn in an enthralling contest
AFL
03:06
The new norm: Hyett sees bright future for female coaches
Female footy coaches are the new norm, says new Bulldogs coach Tamara Hyett, and she has a fellow AFLW coach to thank for opening the door
AFLW
05:52
Footy Feed: Tigers star out, Membrey opens up, Pie to debut
Nat Edwards and Josh Gabelich with the latest footy news
AFL
18:54
44 Sons: The inside story of Fly's 'Flagpies'
Craig McRae, Darcy Moore and Collingwood's leading players look back at the Magpies' path to 2023 premiership glory
AFL
11:26
Cal and Sarah’s pre-season tips: Flag, Brownlow, breakout star, more
Sarah Olle and Cal Twomey deliver 15 pre-season predictions on the eve of the 2024 Toyota AFL Premiership Season
AFL
Editor's Pick
Opinion
Opinion
Opening Round preview: Old rivalries reignite, teams out for revenge
A historic Opening Round in Sydney, Brisbane and the Gold Coast will kick off the AFL season
AFL
Opinion
Opinion
Expert predictions: Damo's surprise Cats call, Cal's bold Port tip
Premiership, Brownlow, recruit of the year. We make the call
AFL
10:14
How the AFL fixture is built: 18 teams, two countries, millions of options
Go inside the complex process of creating the annual AFL premiership season fixture
AFL
More News
Previous
Next
Suns brace for growing pains under new coach Hardwick
After previously playing under Damien Hardwick at Richmond, Gold Coast winger Brandon Ellis admits the Suns will take time to get used to the gameplan
AFL
Fantasy
Fantasy
AFL Fantasy starts in round one, other changes for 2024
The introduction of Opening Round means AFL Fantasy will be a little different in 2024
AFL
fantasy
Prelim heartbreak lingers, but Giants have eyes on the Pies
Greater Western Sydney will lean into the emotions of its preliminary final rematch against Collingwood, coach Adam Kinglsey says
AFL
LISTEN: Same old Dees, Nat reflects on International Women's Day
Join Nat Edwards and Damian Barrett for AFL Daily, as Nat reflects on her experiences in footy on International Women's Day
AFL
podcasts
Star Dog to push R1 case in VFL, ex-Saint in line for AFL comeback
Jack Macrae will play a VFL practice match this weekend in a bid for selection in the R1 team
AFL
The off-season change that has Cats defender approaching his 'peak'
A flawless pre-season has Sam De Koning heading into 2024 full of confidence
AFL
'That's what I thrive on': Why Hyett answered the coaching call
Sarah Black chats with new Western Bulldogs coach Tamara Hyett
AFLW
Rowell on new look, role and why Opening Round is critical
Entering his fifth AFL season, Suns midfielder Matt Rowell has already had a wide array of experiences
AFL
Hot streak: Lion's insane record stretches to 26 games
One Brisbane player hasn't been part of a losing side at the Gabba since round one of 2021
AFL
'His second half was huge': Gun recruit stars against old mates
Brodie Grundy has earned praise from both John Longmire and Simon Goodwin after leading Sydney to victory
AFL
Fantasy News
Previous
Next
Fantasy
Fantasy
AFL Fantasy starts in round one, other changes for 2024
The introduction of Opening Round means AFL Fantasy will be a little different in 2024
AFL
fantasy
Fantasy
Fantasy
LISTEN: Fantasy eyes on Williams, Coleman, Swans-Dees takeaways
The Traders preview Opening Round ahead of the 2024 AFL Fantasy launch next week
AFL
fantasy
Fantasy
Fantasy
Fantasy Freako's rookie notes: 14 cash cows to keep tabs on
Get intel on the best draftees to consider for your Fantasy team
AFL
fantasy
Fantasy
Fantasy
Ultimate Fantasy cheat sheet: Points, CBAs, kick-ins, more
All the Fantasy points, CBAs, kick-ins, time on ground from the AAMI Community Series
AFL
fantasy
Fantasy
Fantasy
Pre-season Fantasy wrap: Locks, bargains, surprise packets, more
Calvin from The Traders assesses the full round of practice games
AFL
fantasy
Fantasy
Fantasy
Fantasy Draft primer: Must-read tips, sleepers, strategy
Are you ready to dominate your Fantasy Draft? Warnie offers his advice
AFL
fantasy
Fantasy
Fantasy
LISTEN: AFL Fantasy wrap of AAMI Community Series
Roy, Calvin and Warnie chat through the last of the practice games
AFL
fantasy
Fantasy
Fantasy
Value, 'cheat code', captains: Tips from reigning Fantasy champion
Newcomer or seasoned player, you can't miss the best advice from last year's Fantasy Classic champion
AFL
fantasy
Fantasy
Fantasy
LISTEN: Relive The Traders' Fantasy-focused call of Hawks-Bulldogs
Roy, Calvin and Warnie brought you coverage of the clash between the Hawks and Bulldogs
AFL
fantasy
Fantasy
Fantasy
The best loser's punishments for your Fantasy league
Introducing a punishment for your Fantasy league's loser is a must
AFL
fantasy
AFLW News
'That's what I thrive on': Why Hyett answered the coaching call
Sarah Black chats with new Western Bulldogs coach Tamara Hyett
AFLW
Mother of an effort: Teammates rally in support of young Hawk's plight
Sophie Locke's Hawthorn teammates answered her call to join her team for a fun run to raise money for Breast Cancer Network Australia
AFLW
Port appoints experienced footy manager as head of AFLW
Shane Grimm takes the reins of head of women's football from Juliet Haslam, who stepped down at he end of last year
AFLW
2024 AFLW Supplementary Selection Period and Rookie Signing Period summary
The AFLW's 2024 Supplementary Selection Period (SSP) and Rookie Signing Period has concluded, with four players added to an AFLW club's list
AFLW
AFL HQ
Damian Barrett
All the latest from Damo. His stories, his videos, his podcasts, and his opinions, all in one place.
Click here for everything Damo
Featured Podcast
AFL Daily
For all your latest footy news and views, listen to AFL Daily every morning, Monday to Friday
View All Episodes
For all your latest footy news and views, listen to AFL Daily every morning, Monday to Friday
View All Episodes
Match Videos
Previous
Next
00:51
Neale and Hewett exchange blows in fiery clash
Tensions spiral as Lachie Neale and George Hewett collide in this heated third-quarter incident
AFL
00:42
Air Daniher pulls down screamer in MOTY contender
Joe Daniher gets lift-off and reels in a huge grab before kicking a much-needed goal for Brisbane
AFL
00:52
Burst of Curnow brilliance brings Carlton right back
Three goals in a matter of minutes from Charlie Curnow sees Carlton close in on Brisbane's lead
AFL
00:38
Tough luck for brave Blue with injured Docherty subbed
Sam Docherty is ruled out of the match following this incident in the first quarter
AFL
00:54
Half-time disaster with gun Lion helped off the field
Brisbane suffers a huge blow with rebounding defender Keidean Coleman going down with a suspected leg injury
AFL
00:45
Speedy Cuningham provides some hope
David Cuningham kicks a much-needed goal on the run to keep Carlton in the contest
AFL
00:50
Zorko’s quick double spells trouble for Blues
A clever soccer goal followed by a perfect set shot from Dayne Zorko has the Lions looking ominous
AFL
00:45
McCluggage makes it look easy with boundary brilliance
Hugh McCluggage slots the set shot from the tightest of angles to open the scoring
AFL
14:18
Mini-Match: Sydney v Melbourne
Extended highlights of the Swans and Demons clash in Opening Round
AFL
08:48
Full post-match, OR: Swans
Watch Sydney’s press conference after Opening Round’s match against Melbourne
AFL
06:02
Full post-match, OR: Demons
Watch Melbourne’s press conference after Opening Round’s match against Sydney
AFL
01:50
Grundy gets the points against former allies
Brodie Grundy shines in his first outing for Sydney, winning the battle against ex-teammate Max Gawn in an enthralling contest
AFL
06:20
Highlights: Sydney v Melbourne
The Swans and Demons clash in Opening Round
AFL
00:42
Van Rooyen’s accidental goal is simply extraordinary
Jacob van Rooyen earns one wild major after a marking attempt fortuitously finds his lower knee before drifting through
AFL
00:36
Warner lights up SCG after hitting one sweet for six
Chad Warner lifts his side with a stunning effort from outside 50
AFL
00:43
Bowey blow after sickening shoulder collision
Melbourne defender Jake Bowey leaves the ground hurt after a brutal clash with Justin McInerney
AFL
00:52
Fritsch catches fire with three in the term
Bayley Fritsch starts to heat up after half-time with a trio of goals in quick time
AFL
00:43
From zero to hero: McLean makes amends for horror miss
Hayden McLean squanders a gilt-edged opportunity right in front of goal before sparing his blushes moments later with a major
AFL
00:47
Papley picks the drop of the footy to perfection
Tom Papley scores an electric goal after guiding through a beautiful effort at full pace
AFL
00:34
Viney refuses to go down in super show of strength
Jack Viney is pumped up after managing to sneak through this powerful goal
AFL
AFL Noticeboard
Previous
Next
MATCH REVIEW: Swan charged with rough conduct on top Dee
The match review for Thursday night's Opening Round game has been completed
AFL
AFL HQ
AFL Statement - Alastair Clarkson
North Melbourne Senior Coach Alastair Clarkson has been found guilty of breaching AFL Rule 2.3(a) (Conduct Unbecoming) in relation to an incident during the AAMI Community Series
AFL
AFL HQ
Workplay welcomes NAB's Beyond the Field Cadetship
A bespoke Women in Sport employment program,?Beyond The Field, has been launched
AFLW
AFL HQ
AFL releases new rules for junior footy
The new rules will help clubs attract and retain players to boost participation
AFL
AFL HQ
2024 AFL Concussion Protocols: Community football to adopt minimum 21 day return to play protocols
The AFL today announced important developments in relation to the return to play protocols in the concussion guidelines
AFL HQ
Jesse Baird and Luke Davies tribute
A tribute to AFL Goal Umpire Jesse Baird and his partner Luke Davies will take place prior to tomorrow night's opening game of the season between Sydney and Melbourne at the SCG
AFL
AFL HQ
Gather Round
Gather Round
AFL launches new Pepsi Collective experience at Gather Round
The AFL is pleased to unveil its new game day experience - The Pepsi Collective –as part of 2024 Gather Round… A Festival of Footy
AFL
AFL HQ
AFL captains have their say on the 2024 Toyota AFL Premiership Season
On the eve of the season, the 18 club captains have had their say on how the season will play out its biggest moments
AFL HQ
Abbey Holmes joins AFL All-Australian selection panel
Abbey Holmes replaces former Geelong premiership captain Cameron Ling on the AFL All-Australian selection panel
AFL
AFL HQ
More From AFL
Toyota AFL Premiership Season Fixture
FULL FIXTURE: Download the complete 2024 Toyota AFL Premiership Season Fixture
NAB AFL Women's Competition
Read all of the latest news from the NAB AFL Women's competition
AFL Draft
WATCH the brightest prospects across the country, out to impress the AFL scouts ahead of this year's draft
Continental Tyres AFL Trade Period
Keep up-to-date with the latest trade news and rumours
Get Involved
Ways to Play
Australian rules football is the game for everyone. Check out how you can get involved.
Coach
Coaches are the backbone of local footy, leading and inspiring participants every week.
Umpire
Umpires are the eyes and ears of the footy field. Whether you’re in the field, boundary or goal, umpiring is a critical role.
Volunteer
Volunteers are the lifeblood of local footy clubs. Find out more about how you can get involved with a club near you.
AFL Live Official App
Follow every game of the 2024 Toyota AFL Premiership Season and Toyota AFL Finals Series, with access to all the live scores and stats.
Naming Rights Partner
Logo of partner Toyota
Major Partners
Logo of partner McDonalds
Logo of partner Telstra footer
Logo of partner Carlton Draught
Logo of partner Nab
View All Partners
Download the Official AFL App
Download on the app store
Google play
Youtube
TikTok
Page Top
AFL Logo
? 2024 AFL
Terms of Use
Privacy Policy
More AFL
About AFL
Mental Health & Wellbeing
Toyota AFL Club Help
Diversity & Inclusion
Contact Us
Get Involved
Play.AFL
Coach.AFL
Umpire.AFL
Schools.AFL
AFL Membership
Acknowledgement of Country
In the spirit of reconciliation the AFL acknowledges the Traditional Custodians of country throughout Australia and their connections to land, sea and community. We pay our respect to their Elders past and present and extend that respect to all Aboriginal and Torres Strait Islander peoples today.
Created by Telstra
Contact Us
Terms and Conditions
Privacy Policy
Copyright & Trademark
Online Security
Why not share?
Close
Share this Stream
Share on Facebook
Share on Twitter
Share on WhatsApp
Copy link
Copied to clipboard!
Share #AFL
Share this article
Loading Gallery
Close
Why not share?
Close
Share This Article
Share on Facebook
Share on Twitter
Share on WhatsApp
Copy link
Copied to clipboard!
Share
Share this article
Up Next
Autoplay
我的AFL入門之路 - 知乎首發(fā)于模糊測(cè)試切換模式寫文章登錄/注冊(cè)我的AFL入門之路薛定諤的廢物AFL-Fuzz介紹AFL(American Fuzzy Lop)是由Google安全工程師Micha? Zalewski開(kāi)發(fā)的一款開(kāi)源fuzzing測(cè)試工具。其可以高效地對(duì)二進(jìn)制程序進(jìn)行fuzzing,挖掘可能存在的內(nèi)存安全漏洞,如棧溢出、堆溢出、UAF、double free等。由于需要在相關(guān)代碼處插樁,因此AFL主要用于對(duì)開(kāi)源軟件進(jìn)行測(cè)試。配合QEMU等工具,也可對(duì)閉源二進(jìn)制代碼進(jìn)行fuzzing,但執(zhí)行效率會(huì)受到影響。工作原理:通過(guò)對(duì)源碼進(jìn)行重新編譯時(shí)進(jìn)行插樁(簡(jiǎn)稱編譯時(shí)插樁)的方式利用自動(dòng)產(chǎn)生測(cè)試用例來(lái)探索二進(jìn)制程序內(nèi)部新的執(zhí)行路徑。AFL也支持直接對(duì)沒(méi)有源碼的二進(jìn)制程序進(jìn)行測(cè)試,但需要QEMU的支持。安裝直接去官網(wǎng)下載壓縮包,解壓后在目錄中打開(kāi)終端輸入: make
sudo make install注:解壓命令如下: tar -zxvf afl-2.52b.tgz 輸入以上命令后基本就能安裝成功了,在終端輸入afl-后tab,就能出現(xiàn)以下這些命令了: 這就表明安裝成功了。使用AFL插樁程序這里以一個(gè)簡(jiǎn)單的C語(yǔ)言程序作為例子。 #include
#include
#include
#include
#include
?
int vuln(char *str)
{
int len = strlen(str);
if(str[0] == 'A' && len == 66)
{
raise(SIGSEGV);
//如果輸入的字符串的首字符為A并且長(zhǎng)度為66,則異常退出
}
else if(str[0] == 'F' && len == 6)
{
raise(SIGSEGV);
//如果輸入的字符串的首字符為F并且長(zhǎng)度為6,則異常退出
}
else
{
printf("it is good!\n");
}
return 0;
}
?
int main(int argc, char *argv[])
{
char buf[100]={0};
gets(buf);//存在棧溢出漏洞
printf(buf);//存在格式化字符串漏洞
vuln(buf);
?
return 0;
}總的流程概述:首先是用afl-gcc編譯源代碼,然后以文件(最好小于1K)為輸入.然后啟動(dòng)afl-fuzz程序,將testcase(輸入的測(cè)試文件)作為程序的輸入執(zhí)行程序,afl會(huì)在這個(gè)testcase的基礎(chǔ)上進(jìn)行自動(dòng)變異輸入,使得程序產(chǎn)生crash,產(chǎn)生了crash就會(huì)被記錄起來(lái)。插樁編譯實(shí)驗(yàn)環(huán)境中文件組織結(jié)構(gòu)如下: 首先把上面的afl_test.c進(jìn)行編譯: afl-gcc -g -o ./afl_test/afl_test ./afl_test/afl_test.c結(jié)果如下: 編譯成功后afl_test文件夾內(nèi)容如下: 同樣的,如果是編譯一個(gè)c++的源碼,那就需要用afl-g++。 接著建立兩個(gè)文件夾:fuzz_in和fuzz_out,用來(lái)存放程序的輸入和fuzz的輸出結(jié)果。 在fuzz_in中還需要?jiǎng)?chuàng)建一個(gè)testcase文件,在這個(gè)程序的例子里,只需要隨便輸入一點(diǎn)東西就行了,那么testcase中就寫aaa就可以了。 注意 在編譯項(xiàng)目時(shí),通常有Makefile,這是就需要在Makefile中添加內(nèi)容: gcc/g++重新編譯程序的方法是: CC=/path/to/afl/afl-gcc ./configure
make clean all對(duì)于一個(gè)C++程序,要設(shè)置: CXX=/path/to/afl/afl-g++.afl-clang和afl-clang++的使用方法類似。開(kāi)始Fuzz對(duì)那些可以直接從stdin讀取輸入的目標(biāo)程序來(lái)說(shuō),語(yǔ)法如下: $ ./afl-fuzz -i testcase_dir -o findings_dir /path/to/program […params…]對(duì)從文件讀取輸入的目標(biāo)程序來(lái)說(shuō),要用“@@”,語(yǔ)法如下: $ ./afl-fuzz -i testcase_dir -o findings_dir /path/to/program @@輸入命令:afl-fuzz -i fuzz_in -o fuzz_out ./afl_test/afl_test表示,從fuzz_in中讀取輸入,輸出放入fuzz_out中,afl_test是我們要進(jìn)行fuzz的程序,-f參數(shù)表示:testcase的內(nèi)容會(huì)作為afl_test的stdin。 報(bào)錯(cuò)如下: 根據(jù)提示設(shè)置一波core_patternsudo su
echo core >/proc/sys/kernel/core_pattern再次執(zhí)行:afl-fuzz -i fuzz_in -o fuzz_out ./afl_test/afl_testAFL界面進(jìn)入Fuzz后,就會(huì)出現(xiàn)如下界面: 界面介紹process timing 展示當(dāng)前fuzzer的運(yùn)行時(shí)間、最近一次發(fā)現(xiàn)新執(zhí)行路徑的時(shí)間、最近一次崩潰的時(shí)間、最近一次超時(shí)的時(shí)間。 值得注意的是第2項(xiàng),最近一次發(fā)現(xiàn)新路徑的時(shí)間。如果由于目標(biāo)二進(jìn)制文件或者命令行參數(shù)出錯(cuò),那么其執(zhí)行路徑應(yīng)該是一直不變的,所以如果從fuzzing開(kāi)始一直沒(méi)有發(fā)現(xiàn)新的執(zhí)行路徑,那么就要考慮是否有二進(jìn)制或者命令行參數(shù)錯(cuò)誤的問(wèn)題了。對(duì)于此狀況,AFL也會(huì)智能地進(jìn)行提醒。 overall results 這里包括運(yùn)行的總周期數(shù)、總路徑數(shù)、崩潰次數(shù)、超時(shí)次數(shù)。 其中,總周期數(shù)可以用來(lái)作為何時(shí)停止fuzzing的參考。隨著不斷地fuzzing,周期數(shù)會(huì)不斷增大,其顏色也會(huì)由洋紅色,逐步變?yōu)辄S色、藍(lán)色、綠色。一般來(lái)說(shuō),當(dāng)其變?yōu)榫G色時(shí),代表可執(zhí)行的內(nèi)容已經(jīng)很少了,繼續(xù)fuzzing下去也不會(huì)有什么新的發(fā)現(xiàn)了。此時(shí),我們便可以通過(guò)Ctrl-C,中止當(dāng)前的fuzzing。 stage progress 這里包括正在測(cè)試的fuzzing策略、進(jìn)度、目標(biāo)的執(zhí)行總次數(shù)、目標(biāo)的執(zhí)行速度。 執(zhí)行速度可以直觀地反映當(dāng)前跑的快不快,如果速度過(guò)慢,比如低于500次每秒,那么測(cè)試時(shí)間會(huì)變得非常漫長(zhǎng)。如果發(fā)生了這種情況,我們需要進(jìn)一步優(yōu)化我們的Fuzzing。 以上是簡(jiǎn)單的介紹,如果要看完整的可以查看官方文檔。分析crash 通過(guò)上圖可以知道,短暫運(yùn)行后發(fā)現(xiàn)了6個(gè)crash。 這時(shí)候可以看看先前建立的fuzz_out目錄中產(chǎn)生了啥東西: crashes文件夾里面是我們產(chǎn)生crash的樣例,hangs里面是產(chǎn)生超時(shí)的樣例,queue里面是每個(gè)不同執(zhí)行路徑的測(cè)試用例。 這時(shí)候來(lái)看看crash的6個(gè)樣例: 第一個(gè)樣例,通過(guò)命令 ··· zouyu@ubuntu:~/project/afl/fuzz_out$ cat crashes/id:000000,sig:06,src:000000,op:havoc,rep:128 | ../afl_test/afl_test ··· 復(fù)現(xiàn)結(jié)果如下: 參考的網(wǎng)站中通過(guò)xxd 命令查看crash文件即可判斷crash的情況,暫時(shí)沒(méi)有看懂為何。如: 第一個(gè)樣例,發(fā)現(xiàn)符合棧溢出漏洞的crash情況 第二個(gè)樣例,發(fā)現(xiàn)符合首字符為F且字符串長(zhǎng)度為6的異常退出情況 ...... 至此,我們自己編寫的簡(jiǎn)單程序的所有漏洞都被檢測(cè)出來(lái)了,這個(gè)過(guò)程只用了5分鐘,afl可以說(shuō)是很強(qiáng)大的。無(wú)源碼AFL測(cè)試上面是對(duì)簡(jiǎn)單的有源碼的程序進(jìn)行測(cè)試的,但是實(shí)際情況下不可能每次都有源碼進(jìn)行插樁編譯測(cè)試,afl使用了qemu模式進(jìn)行測(cè)試,只要在之前的命令的基礎(chǔ)上加上-Q的參數(shù)即可 但是要先進(jìn)行安裝,在afl的根目錄打開(kāi)終端執(zhí)行以下命令:cd qemu_mode
./build_qemu_support.sh
cd ..
make install安裝過(guò)程中一系列報(bào)錯(cuò),解決方案可參考AFL(二)afl-qemu無(wú)源碼fuzz。 未能完全解決,在打補(bǔ)丁安裝qemu時(shí)一致失敗。 此后繼續(xù)尋找新方法: 在運(yùn)行./build_qumu_support.sh前,創(chuàng)建一個(gè)名為“memfd_create.diff”的文件,然后將下列代碼粘進(jìn)去:diff -ru qemu-2.10.0-clean/util/memfd.c qemu-2.10.0/util/memfd.c
--- qemu-2.10.0-clean/util/memfd.c 2018-11-20 18:11:00.170271506 +0100
+++ qemu-2.10.0/util/memfd.c 2018-11-20 18:11:13.398423613 +0100
@@ -37,7 +37,7 @@
#include
#include
-static int memfd_create(const char *name, unsigned int flags)
+int memfd_create(const char *name, unsigned int flags)
{
#ifdef __NR_memfd_create
return syscall(__NR_memfd_create, name, flags);之后將memfd_create.diff放在patches/目錄下,然后修改build_qemu_support.sh,找到文件中的 patch -p1 <../patches/elfload.diff || exit 1
patch -p1 <../patches/cpu-exec.diff || exit 1
patch -p1 <../patches/syscall.diff || exit 1在之后加一行:patch -p1 <../patches/memfd_create.diff || exit 1然后再次運(yùn)行build_qemu_support.sh即可繼續(xù)下一步。 等最后安裝完畢后,便可以進(jìn)行無(wú)源碼Fuzz了。簡(jiǎn)單無(wú)源碼fuzz繼續(xù)使用上面簡(jiǎn)單c代碼進(jìn)行測(cè)試,但這次采用gcc進(jìn)行編譯,而不是afl-gcc。將afl_test.c編譯為afl_test2:gcc -g -o afl_test2 afl_test.c同時(shí)依然要在fuzz前創(chuàng)建input 和output文件夾。 執(zhí)行命令:afl-fuzz -i ../workshop/input/ -o ../workshop/output/ -Q ../workshop/afl_test2結(jié)果如下: 可以看出:同樣的程序,在qemu 模式下比在源碼編譯插樁的模式下會(huì)慢很多。(通過(guò)觀察stage progress下的exec speed)一個(gè)fuzz實(shí)例這里用一個(gè)例子來(lái)fuzz一下,測(cè)試readelf。 由于readelf的輸入其實(shí)就是elf文件,因此需要在in目錄下放一個(gè)輸入elf。 按照流程創(chuàng)建文件夾和測(cè)試用的elf。 初始文件布局如下: 首先進(jìn)入workshop文件夾下之后開(kāi)始執(zhí)行命令:mkdir in out
cd in
cp ../../afl_program/testcases/others/elf/small_exec.elf . # afl目錄中自帶一些常用文件的testcase
cd ..
sudo cp /usr/bin/readelf . # 將readelf復(fù)制到當(dāng)前目錄來(lái)
afl-fuzz -i ../workshop/in -o ../workshop/out/ -Q ../workshop/readelf -a @@ # 開(kāi)始fuzz,@@表示從in文件夾中找elf作為輸入,實(shí)際上是在執(zhí)行readelf -a 文件名。
注:最后一步是在afl程序所在的文件夾下運(yùn)行,見(jiàn)下圖:
最終運(yùn)行結(jié)果如下: 本文主要流程參考:初探AFL-Fuzz qemu安裝時(shí)報(bào)錯(cuò)解決方法 afl: Add support for emulated mode with QEMU附錄:AFL變異策略確定性變異比特翻轉(zhuǎn)(bitflip):按位翻轉(zhuǎn),1變?yōu)?,0變?yōu)?.這一階段還會(huì)按照不同的長(zhǎng)度和步長(zhǎng)進(jìn)行多種不同的翻轉(zhuǎn),每次翻轉(zhuǎn)1/2/4/8/16/32 bit,依次進(jìn)行。算術(shù)運(yùn)算(arithmetic):整數(shù)加/減算術(shù)運(yùn)算。跟bitflip類似,arithmetic根據(jù)目標(biāo)大小的不同,也分為了多個(gè)子階段,依次對(duì)8/16/32 bit進(jìn)行加減運(yùn)算。特殊值替換(interest):把一些特殊內(nèi)容替換到原文件中。同樣每次對(duì)8/16/32 bit進(jìn)行替換。所謂的特殊內(nèi)容是AFL預(yù)設(shè)的一些比較特殊的數(shù),比如可能造成溢出的數(shù)。字典值(dictionary):把自動(dòng)生成或用戶提供的字典值替換或插入到原測(cè)試用例中。隨機(jī)變異havoc大破壞:對(duì)文件進(jìn)行大量破壞,此階段會(huì)對(duì)原文件進(jìn)行大量隨機(jī)變異。包括隨機(jī)翻轉(zhuǎn)、加減、替換和刪除等操作。文件拼接splice:此階段會(huì)將兩個(gè)文件拼接起來(lái)得到一個(gè)新的文件,并對(duì)這個(gè)新文件繼續(xù)執(zhí)行havoc變異。發(fā)布于 2022-06-05 18:20模糊測(cè)試?贊同 22??8 條評(píng)論?分享?喜歡?收藏?申請(qǐng)轉(zhuǎn)載?文章被以下專欄收錄模糊測(cè)試模糊測(cè)試學(xué)習(xí)
AFL漏洞挖掘技術(shù)漫談(一):用AFL開(kāi)始你的第一次Fuzzing - FreeBuf網(wǎng)絡(luò)安全行業(yè)門戶
主站 分類
漏洞
工具
極客
Web安全
系統(tǒng)安全
網(wǎng)絡(luò)安全
無(wú)線安全
設(shè)備/客戶端安全
數(shù)據(jù)安全
安全管理
企業(yè)安全
工控安全
特色
頭條
人物志
活動(dòng)
視頻
觀點(diǎn)
招聘
報(bào)告
資訊
區(qū)塊鏈安全
標(biāo)準(zhǔn)與合規(guī)
容器安全
公開(kāi)課
報(bào)告 專輯 ···公開(kāi)課···商城···
用戶服務(wù)
··· 行業(yè)服務(wù)
政 府
CNCERT
CNNVD
會(huì)員體系(甲方)
會(huì)員體系(廠商)
產(chǎn)品名錄
企業(yè)空間
知識(shí)大陸 搜索 創(chuàng)作中心 登錄注冊(cè) 官方公眾號(hào)企業(yè)安全新浪微博 FreeBuf.COM網(wǎng)絡(luò)安全行業(yè)門戶,每日發(fā)布專業(yè)的安全資訊、技術(shù)剖析。 FreeBuf+小程序把安全裝進(jìn)口袋 AFL漏洞挖掘技術(shù)漫談(一):用AFL開(kāi)始你的第一次Fuzzing
關(guān)注
漏洞 AFL漏洞挖掘技術(shù)漫談(一):用AFL開(kāi)始你的第一次Fuzzing
2018-12-07 16:35:01
一、前言模糊測(cè)試(Fuzzing)技術(shù)作為漏洞挖掘最有效的手段之一,近年來(lái)一直是眾多安全研究人員發(fā)現(xiàn)漏洞的首選技術(shù)。AFL、LibFuzzer、honggfuzz等操作簡(jiǎn)單友好的工具相繼出現(xiàn),也極大地降低了模糊測(cè)試的門檻。阿爾法實(shí)驗(yàn)室的同學(xué)近期學(xué)習(xí)漏洞挖掘過(guò)程中,感覺(jué)目前網(wǎng)上相關(guān)的的資源有些冗雜,讓初學(xué)者有些無(wú)從著手,便想在此對(duì)學(xué)習(xí)過(guò)程中收集的一些優(yōu)秀的博文、論文和工具進(jìn)行總結(jié)與梳理、分享一些學(xué)習(xí)過(guò)程中的想法和心得,同時(shí)對(duì)網(wǎng)上一些沒(méi)有涉及到的內(nèi)容做些補(bǔ)充。由于相關(guān)話題涉及的內(nèi)容太廣,筆者決定將所有內(nèi)容分成一系列文章,且只圍繞AFL這一具有里程碑意義的工具展開(kāi),從最簡(jiǎn)單的使用方法和基本概念講起,再由淺入深介紹測(cè)試完后的后續(xù)工作、如何提升Fuzzing速度、一些使用技巧以及對(duì)源碼的分析等內(nèi)容。因?yàn)楣P者接觸該領(lǐng)域也不久,內(nèi)容中難免出現(xiàn)一些錯(cuò)誤和紕漏,歡迎大家在評(píng)論中指正。第一篇文章旨在讓讀者對(duì)AFL的使用流程有個(gè)基本的認(rèn)識(shí),文中將討論如下一些基本問(wèn)題:AFL的基本原理和工作流程;如何選擇Fuzzing的?標(biāo)?如何獲得初始語(yǔ)料庫(kù)?如何使用AFL構(gòu)建程序?AFL的各種執(zhí)行方式;AFL狀態(tài)窗口中各部分代表了什么意義?二、AFL簡(jiǎn)介AFL(American Fuzzy Lop)是由安全研究員Micha? Zalewski(@lcamtuf)開(kāi)發(fā)的一款基于覆蓋引導(dǎo)(Coverage-guided)的模糊測(cè)試工具,它通過(guò)記錄輸入樣本的代碼覆蓋率,從而調(diào)整輸入樣本以提高覆蓋率,增加發(fā)現(xiàn)漏洞的概率。其工作流程大致如下:①?gòu)脑创a編譯程序時(shí)進(jìn)行插樁,以記錄代碼覆蓋率(Code Coverage);②選擇一些輸入文件,作為初始測(cè)試集加入輸入隊(duì)列(queue);③將隊(duì)列中的文件按一定的策略進(jìn)行“突變”;④如果經(jīng)過(guò)變異文件更新了覆蓋范圍,則將其保留添加到隊(duì)列中;⑤上述過(guò)程會(huì)一直循環(huán)進(jìn)行,期間觸發(fā)了crash的文件會(huì)被記錄下來(lái)。三、選擇和評(píng)估測(cè)試的目標(biāo)開(kāi)始Fuzzing前,首先要選擇一個(gè)目標(biāo)。 AFL的目標(biāo)通常是接受外部輸入的程序或庫(kù),輸入一般來(lái)自文件(后面的文章也會(huì)介紹如何Fuzzing一個(gè)網(wǎng)絡(luò)程序)。1. 用什么語(yǔ)言編寫AFL主要用于C/C++程序的測(cè)試,所以這是我們尋找軟件的最優(yōu)先規(guī)則。(也有一些基于AFL的JAVA Fuzz程序如kelinci、java-afl等,但并不知道效果如何)2. 是否開(kāi)源AFL既可以對(duì)源碼進(jìn)行編譯時(shí)插樁,也可以使用AFL的QEMU mode對(duì)二進(jìn)制文件進(jìn)行插樁,但是前者的效率相對(duì)來(lái)說(shuō)要高很多,在Github上很容易就能找到很多合適的項(xiàng)目。3. 程序版本目標(biāo)應(yīng)該是該軟件的最新版本,不然辛辛苦苦找到一個(gè)漏洞,卻發(fā)現(xiàn)早就被上報(bào)修復(fù)了就尷尬了。4. 是否有示例程序、測(cè)試用例如果目標(biāo)有現(xiàn)成的基本代碼示例,特別是一些開(kāi)源的庫(kù),可以方便我們調(diào)用該庫(kù)不用自己再寫一個(gè)程序;如果目標(biāo)存在測(cè)試用例,那后面構(gòu)建語(yǔ)料庫(kù)時(shí)也省事兒一點(diǎn)。5.項(xiàng)目規(guī)模某些程序規(guī)模很大,會(huì)被分為好幾個(gè)模塊,為了提高Fuzz效率,在Fuzzing前,需要定義Fuzzing部分。這里推薦一下源碼閱讀工具Understand,它treemap功能,可以直觀地看到項(xiàng)目結(jié)構(gòu)和規(guī)模。比如下面ImageMagick的源碼中,灰框代表一個(gè)文件夾,藍(lán)色方塊代表了一個(gè)文件,其大小和顏色分別反映了行數(shù)和文件復(fù)雜度。6. 程序曾出現(xiàn)過(guò)漏洞如果某個(gè)程序曾曝出過(guò)多次漏洞,那么該程序有仍有很大可能存在未被發(fā)現(xiàn)的安全漏洞。如ImageMagick每個(gè)月都會(huì)發(fā)現(xiàn)難以利用的新漏洞,并且每年都會(huì)發(fā)生一些具有高影響的嚴(yán)重漏洞,圖中可以看到僅2017年就有357個(gè)CVE!(圖源medium.com)四、構(gòu)建語(yǔ)料庫(kù)AFL需要一些初始輸入數(shù)據(jù)(也叫種子文件)作為Fuzzing的起點(diǎn),這些輸入甚至可以是毫無(wú)意義的數(shù)據(jù),AFL可以通過(guò)啟發(fā)式算法自動(dòng)確定文件格式結(jié)構(gòu)。lcamtuf就在博客中給出了一個(gè)有趣的例子——對(duì)djpeg進(jìn)行Fuzzing時(shí),僅用一個(gè)字符串"hello"作為輸入,最后憑空生成大量jpge圖像!盡管AFL如此強(qiáng)大,但如果要獲得更快的Fuzzing速度,那么就有必要生成一個(gè)高質(zhì)量的語(yǔ)料庫(kù),這一節(jié)就解決如何選擇輸入文件、從哪里尋找這些文件、如何精簡(jiǎn)找到的文件三個(gè)問(wèn)題。1. 選擇(1) 有效的輸入盡管有時(shí)候無(wú)效輸入會(huì)產(chǎn)生bug和崩潰,但有效輸入可以更快的找到更多執(zhí)行路徑。(2) 盡量小的體積較小的文件會(huì)不僅可以減少測(cè)試和處理的時(shí)間,也能節(jié)約更多的內(nèi)存,AFL給出的建議是最好小于1 KB,但其實(shí)可以根據(jù)自己測(cè)試的程序權(quán)衡,這在AFL文檔的perf_tips.txt中有具體說(shuō)明。2. 尋找使用項(xiàng)目自身提供的測(cè)試用例目標(biāo)程序bug提交頁(yè)面使用格式轉(zhuǎn)換器,用從現(xiàn)有的文件格式生成一些不容易找到的文件格式:afl源碼的testcases目錄下提供了一些測(cè)試用例其他開(kāi)源的語(yǔ)料庫(kù)afl generated image test setsfuzzer-test-suitelibav samplesffmpeg samplesfuzzdatamoonshine3. 修剪網(wǎng)上找到的一些大型語(yǔ)料庫(kù)中往往包含大量的文件,這時(shí)就需要對(duì)其精簡(jiǎn),這個(gè)工作有個(gè)術(shù)語(yǔ)叫做——語(yǔ)料庫(kù)蒸餾(Corpus Distillation)。AFL提供了兩個(gè)工具來(lái)幫助我們完成這部工作——afl-cmin和afl-tmin。(1) 移除執(zhí)行相同代碼的輸入文件——afl-cminafl-cmin的核心思想是:嘗試找到與語(yǔ)料庫(kù)全集具有相同覆蓋范圍的最小子集。舉個(gè)例子:假設(shè)有多個(gè)文件,都覆蓋了相同的代碼,那么就丟掉多余的文件。其使用方法如下:$ afl-cmin -i input_dir -o output_dir -- /path/to/tested/program [params]更多的時(shí)候,我們需要從文件中獲取輸入,這時(shí)可以使用“@@”代替被測(cè)試程序命令行中輸入文件名的位置。Fuzzer會(huì)將其替換為實(shí)際執(zhí)行的文件:$ afl-cmin -i input_dir -o output_dir -- /path/to/tested/program [params] @@下面的例子中,我們將一個(gè)有1253個(gè)png文件的語(yǔ)料庫(kù),精簡(jiǎn)到只包含60個(gè)文件。(2) 減小單個(gè)輸入文件的大小——afl-tmin整體的大小得到了改善,接下來(lái)還要對(duì)每個(gè)文件進(jìn)行更細(xì)化的處理。afl-tmin縮減文件體積的原理這里就不深究了,有機(jī)會(huì)會(huì)在后面文章中解釋,這里只給出使用方法(其實(shí)也很簡(jiǎn)單,有興趣的朋友可以自己搜一搜)。afl-tmin有兩種工作模式,instrumented mode和crash mode。默認(rèn)的工作方式是instrumented mode,如下所示:$ afl-tmin -i input_file -o output_file -- /path/to/tested/program [params] @@如果指定了參數(shù)-x,即crash mode,會(huì)把導(dǎo)致程序非正常退出的文件直接剔除。$ afl-tmin -x -i input_file -o output_file -- /path/to/tested/program [params] @@afl-tmin接受單個(gè)文件輸入,所以可以用一條簡(jiǎn)單的shell腳本批量處理。如果語(yǔ)料庫(kù)中文件數(shù)量特別多,且體積特別大的情況下,這個(gè)過(guò)程可能花費(fèi)幾天甚至更長(zhǎng)的時(shí)間!for i in *; do afl-tmin -i $i -o tmin-$i -- ~/path/to/tested/program [params] @@; done;下圖是經(jīng)過(guò)兩種模式的修剪后,語(yǔ)料庫(kù)大小的變化:這時(shí)還可以再次使用afl-cmin,發(fā)現(xiàn)又可以過(guò)濾掉一些文件了。五、構(gòu)建被測(cè)試程序前面說(shuō)到,AFL從源碼編譯程序時(shí)進(jìn)行插樁,以記錄代碼覆蓋率。這個(gè)工作需要使用其提供的兩種編譯器的wrapper編譯目標(biāo)程序,和普通的編譯過(guò)程沒(méi)有太大區(qū)別,本節(jié)就只簡(jiǎn)單演示一下。1. afl-gcc模式afl-gcc/afl-g++作為gcc/g++的wrapper,它們的用法完全一樣,前者會(huì)將接收到的參數(shù)傳遞給后者,我們編譯程序時(shí)只需要將編譯器設(shè)置為afl-gcc/afl-g++就行,如下面演示的那樣。如果程序不是用autoconf構(gòu)建,直接修改Makefile文件中的編譯器為afl-gcc/g++也行。$ ./configure CC="afl-gcc" CXX="afl-g++"在Fuzzing共享庫(kù)時(shí),可能需要編寫一個(gè)簡(jiǎn)單demo,將輸入傳遞給要Fuzzing的庫(kù)(其實(shí)大多數(shù)項(xiàng)目中都自帶了類似的demo)。這種情況下,可以通過(guò)設(shè)置LD_LIBRARY_PATH讓程序加載經(jīng)過(guò)AFL插樁的.so文件,不過(guò)最簡(jiǎn)單的方法是靜態(tài)構(gòu)建,通過(guò)以下方式實(shí)現(xiàn):$ ./configure --disable-shared CC="afl-gcc" CXX="afl-g++" 2. LLVM模式LLVM Mode模式編譯程序可以獲得更快的Fuzzing速度,進(jìn)入llvm_mode目錄進(jìn)行編譯,之后使用afl-clang-fast構(gòu)建序程序即可,如下所示:$ cd llvm_mode$ apt-get install clang$ export LLVM_CONFIG=`which llvm-config` && make && cd ..$ ./configure --disable-shared CC="afl-clang-fast" CXX="afl-clang-fast++" 筆者在使用高版本的clang編譯時(shí)會(huì)報(bào)錯(cuò),換成clang-3.9后通過(guò)編譯,如果你的系統(tǒng)默認(rèn)安裝的clang版本過(guò)高,可以安裝多個(gè)版本然后使用update-alternatives切換。六、開(kāi)始Fuzzingafl-fuzz程序是AFL進(jìn)行Fuzzing的主程序,用法并不難,但是其背后巧妙的工作原理很值得研究,考慮到第一篇文章只是讓讀者有個(gè)初步的認(rèn)識(shí),這節(jié)只簡(jiǎn)單的演示如何將Fuzzer跑起來(lái),其他具體細(xì)節(jié)這里就暫時(shí)略過(guò)。1. 白盒測(cè)試(1) 測(cè)試插樁程序編譯好程序后,可以選擇使用afl-showmap跟蹤單個(gè)輸入的執(zhí)行路徑,并打印程序執(zhí)行的輸出、捕獲的元組(tuples),tuple用于獲取分支信息,從而衡量衡量程序覆蓋情況,下一篇文章中會(huì)詳細(xì)的解釋,這里可以先不用管。$ afl-showmap -m none -o /dev/null -- ./build/bin/imagew 23.bmp out.png[*] Executing './build/bin/imagew'...-- Program output begins --23.bmp -> out.pngProcessing: 13x32-- Program output ends --[+] Captured 1012 tuples in '/dev/null'.使用不同的輸入,正常情況下afl-showmap會(huì)捕獲到不同的tuples,這就說(shuō)明我們的的插樁是有效的,還有前面提到的afl-cmin就是通過(guò)這個(gè)工具來(lái)去掉重復(fù)的輸入文件。$ $ afl-showmap -m none -o /dev/null -- ./build/bin/imagew 111.pgm out.png[*] Executing './build/bin/imagew'...-- Program output begins --111.pgm -> out.pngProcessing: 7x7-- Program output ends --[+] Captured 970 tuples in '/dev/null'.(2) 執(zhí)行fuzzer在執(zhí)行afl-fuzz前,如果系統(tǒng)配置為將核心轉(zhuǎn)儲(chǔ)文件(core)通知發(fā)送到外部程序。 將導(dǎo)致將崩潰信息發(fā)送到Fuzzer之間的延遲增大,進(jìn)而可能將崩潰被誤報(bào)為超時(shí),所以我們得臨時(shí)修改core_pattern文件,如下所示:echo core >/proc/sys/kernel/core_pattern之后就可以執(zhí)行afl-fuzz了,通常的格式是:$ afl-fuzz -i testcase_dir -o findings_dir /path/to/program [params]或者使用“@@”替換輸入文件,F(xiàn)uzzer會(huì)將其替換為實(shí)際執(zhí)行的文件:$ afl-fuzz -i testcase_dir -o findings_dir /path/to/program @@如果沒(méi)有什么錯(cuò)誤,F(xiàn)uzzer就正式開(kāi)始工作了。首先,對(duì)輸入隊(duì)列中的文件進(jìn)行預(yù)處理;然后給出對(duì)使用的語(yǔ)料庫(kù)可警告信息,比如下圖中提示有個(gè)較大的文件(14.1KB),且輸入文件過(guò)多;最后,開(kāi)始Fuzz主循環(huán),顯示狀態(tài)窗口。(3) 使用screen一次Fuzzing過(guò)程通常會(huì)持續(xù)很長(zhǎng)時(shí)間,如果這期間運(yùn)行afl-fuzz實(shí)例的終端終端被意外關(guān)閉了,那么Fuzzing也會(huì)被中斷。而通過(guò)在screen session中啟動(dòng)每個(gè)實(shí)例,可以方便的連接和斷開(kāi)。關(guān)于screen的用法這里就不再多講,大家可以自行查詢。$ screen afl-fuzz -i testcase_dir -o findings_dir /path/to/program @@也可以為每個(gè)session命名,方便重新連接。$ screen -S fuzzer1$ afl-fuzz -i testcase_dir -o findings_dir /path/to/program [params] @@[detached from 6999.fuzzer1]$ screen -r fuzzer1 ...2. 黑盒測(cè)試所謂黑盒測(cè)試,通俗地講就是對(duì)沒(méi)有源代碼的程序進(jìn)行測(cè)試,這時(shí)就要用到AFL的QEMU模式了。啟用方式和LLVM模式類似,也要先編譯。但注意,因?yàn)锳FL使用的QEMU版本太舊,util/memfd.c中定義的函數(shù)memfd_create()會(huì)和glibc中的同名函數(shù)沖突,在這里可以找到針對(duì)QEMU的patch,之后運(yùn)行腳本build_qemu_support.sh就可以自動(dòng)下載編譯。$ apt-get install libini-config-dev libtool-bin automake bison libglib2.0-dev -y$ cd qemu_mode$ build_qemu_support.sh$ cd .. && make install現(xiàn)在起,只需添加-Q選項(xiàng)即可使用QEMU模式進(jìn)行Fuzzing。$ afl-fuzz -Q -i testcase_dir -o findings_dir /path/to/program [params] @@3. 并行測(cè)試(1) 單系統(tǒng)并行測(cè)試如果你有一臺(tái)多核心的機(jī)器,可以將一個(gè)afl-fuzz實(shí)例綁定到一個(gè)對(duì)應(yīng)的核心上,也就是說(shuō),機(jī)器上有幾個(gè)核心就可以運(yùn)行多少afl-fuzz 實(shí)例,這樣可以極大的提升執(zhí)行速度,雖然大家都應(yīng)該知道自己的機(jī)器的核心數(shù),不過(guò)還是提一下怎么查看吧:$ cat /proc/cpuinfo| grep "cpu cores"| uniqafl-fuzz并行Fuzzing,一般的做法是通過(guò)-M參數(shù)指定一個(gè)主Fuzzer(Master Fuzzer)、通過(guò)-S參數(shù)指定多個(gè)從Fuzzer(Slave Fuzzer)。$ screen afl-fuzz -i testcases/ -o sync_dir/ -M fuzzer1 -- ./program$ screen afl-fuzz -i testcases/ -o sync_dir/ -S fuzzer2 -- ./program$ screen afl-fuzz -i testcases/ -o sync_dir/ -S fuzzer3 -- ./program ...這兩種類型的Fuzzer執(zhí)行不同的Fuzzing策略,前者進(jìn)行確定性測(cè)試(deterministic ),即對(duì)輸入文件進(jìn)行一些特殊而非隨機(jī)的的變異;后者進(jìn)行完全隨機(jī)的變異??梢钥吹竭@里的-o指定的是一個(gè)同步目錄,并行測(cè)試中,所有的Fuzzer將相互協(xié)作,在找到新的代碼路徑時(shí),相互傳遞新的測(cè)試用例,如下圖中以Fuzzer0的角度來(lái)看,它查看其它fuzzer的語(yǔ)料庫(kù),并通過(guò)比較id來(lái)同步感興趣的測(cè)試用例。afl-whatsup工具可以查看每個(gè)fuzzer的運(yùn)行狀態(tài)和總體運(yùn)行概況,加上-s選項(xiàng)只顯示概況,其中的數(shù)據(jù)都是所有fuzzer的總和。還afl-gotcpu工具可以查看每個(gè)核心使用狀態(tài)。(2) 多系統(tǒng)并行測(cè)試多系統(tǒng)并行的基本工作原理類似于單系統(tǒng)并行中描述的機(jī)制,你需要一個(gè)簡(jiǎn)單的腳本來(lái)完成兩件事。在本地系統(tǒng)上,壓縮每個(gè)fuzzer實(shí)例目錄中queue下的文件,通過(guò)SSH分發(fā)到其他機(jī)器上解壓。來(lái)看一個(gè)例子,假設(shè)現(xiàn)在有兩臺(tái)機(jī)器,基本信息如下:fuzzer1fuzzerr2172.21.5.101172.21.5.102運(yùn)行2個(gè)實(shí)例運(yùn)行4個(gè)實(shí)例為了能夠自動(dòng)同步數(shù)據(jù),需要使用authorized_keys的方式進(jìn)行身份驗(yàn)證?,F(xiàn)要將fuzzer2中每個(gè)實(shí)例的輸入隊(duì)列同步到fuzzer1中,可以下面的方式:#!/bin/sh?# 所有要同步的主機(jī)FUZZ_HOSTS='172.21.5.101 172.21.5.102'# SSH userFUZZ_USER=root# 同步目錄SYNC_DIR='/root/syncdir'# 同步間隔時(shí)間SYNC_INTERVAL=$((30 * 60))?if [ "$AFL_ALLOW_TMP" = "" ]; then if [ "$PWD" = "/tmp" -o "$PWD" = "/var/tmp" ]; then echo "[-] Error: do not use shared /tmp or /var/tmp directories with this script." 1>&2 exit 1 fifi?rm -rf .sync_tmp 2>/dev/nullmkdir .sync_tmp || exit 1?while :; do? # 打包所有機(jī)器上的數(shù)據(jù) for host in $FUZZ_HOSTS; do echo "[*] Retrieving data from ${host}..." ssh -o 'passwordauthentication no' ${FUZZ_USER}@${host} \ "cd '$SYNC_DIR' && tar -czf - SESSION*" >".sync_tmp/${host}.tgz" done? # 分發(fā)數(shù)據(jù)? for dst_host in $FUZZ_HOSTS; do echo "[*] Distributing data to ${dst_host}..." for src_host in $FUZZ_HOSTS; do test "$src_host" = "$dst_host" && continue echo " Sending fuzzer data from ${src_host}..." ssh -o 'passwordauthentication no' ${FUZZ_USER}@$dst_host \ "cd '$SYNC_DIR' && tar -xkzf - &>/dev/null" <".sync_tmp/${src_host}.tgz" done done? echo "[+] Done. Sleeping for $SYNC_INTERVAL seconds (Ctrl-C to quit)." sleep $SYNC_INTERVAL done成功執(zhí)行上述shell腳本后,不僅SESSION000 SESSION002中的內(nèi)容更新了,還將SESSION003 SESSION004也同步了過(guò)來(lái)。七、認(rèn)識(shí)AFL狀態(tài)窗口① Process timing:Fuzzer運(yùn)行時(shí)長(zhǎng)、以及距離最近發(fā)現(xiàn)的路徑、崩潰和掛起經(jīng)過(guò)了多長(zhǎng)時(shí)間。② Overall results:Fuzzer當(dāng)前狀態(tài)的概述。③ Cycle progress:我們輸入隊(duì)列的距離。④ Map coverage:目標(biāo)二進(jìn)制文件中的插樁代碼所觀察到覆蓋范圍的細(xì)節(jié)。⑤ Stage progress:Fuzzer現(xiàn)在正在執(zhí)行的文件變異策略、執(zhí)行次數(shù)和執(zhí)行速度。⑥ Findings in depth:有關(guān)我們找到的執(zhí)行路徑,異常和掛起數(shù)量的信息。⑦ Fuzzing strategy yields:關(guān)于突變策略產(chǎn)生的最新行為和結(jié)果的詳細(xì)信息。⑧ Path geometry:有關(guān)Fuzzer找到的執(zhí)行路徑的信息。⑨ CPU load:CPU利用率八、總結(jié)到此為止,本文已經(jīng)介紹完了如何開(kāi)始一次Fuzzing,但這僅僅是一個(gè)開(kāi)始。AFL 的Fuzzing過(guò)程是一個(gè)死循環(huán),我們需要人為地停止,那么什么時(shí)候停止?上面圖中跑出的18個(gè)特別的崩潰,又如何驗(yàn)證?還有文中提到的各種概念——代碼覆蓋率、元組、覆蓋引導(dǎo)等等又是怎么回事?所謂學(xué)非探其花,要自拔其根,學(xué)會(huì)工具的基本用法后,要想繼續(xù)進(jìn)階的話,掌握這些基本概念相當(dāng)重要,也有助于理解更深層次內(nèi)容。所以后面的幾篇文章,首先會(huì)繼續(xù)本文中未完成的工作,然后詳細(xì)講解重要概念和AFL背后的原理,敬請(qǐng)各位期待。參考資料[1]American Fuzzy Lop[2]Yet another memory leak in ImageMagick[3]Vulnerability Discovery Against Apple Safari[4]Pulling JPEGs out of thin air[5]parallel_fuzzing.txt[6]Fuzzing workflows; a fuzz job from start to finish[7]Open Source Fuzzing Tools - 'Chapter 10 Code Coverage and Fuzzing'[8]Fuzzing for Software Security Testing and Quality Assurance - '7.2 Using Code Coverage Information' 本文作者:,
轉(zhuǎn)載請(qǐng)注明來(lái)自FreeBuf.COM # 漏洞挖掘 # fuzzing
被以下專輯收錄,發(fā)現(xiàn)更多精彩內(nèi)容
+ 收入我的專輯
+ 加入我的收藏
展開(kāi)更多
相關(guān)推薦
關(guān) 注 0 文章數(shù) 0 關(guān)注者 本站由阿里云 提供計(jì)算與安全服務(wù) 用戶服務(wù) 有獎(jiǎng)投稿 提交漏洞 參與眾測(cè) 商城 企業(yè)服務(wù) 安全咨詢 產(chǎn)業(yè)全景圖 企業(yè)SRC 安全眾測(cè) 合作信息 斗象官網(wǎng) 廣告投放 聯(lián)系我們 友情鏈接 關(guān)于我們 關(guān)于我們 加入我們 微信公眾號(hào) 新浪微博 戰(zhàn)略伙伴 FreeBuf+小程序 掃碼把安全裝進(jìn)口袋 斗象科技 FreeBuf 漏洞盒子 斗象智能安全平臺(tái) 免責(zé)條款 協(xié)議條款
Copyright ? 2020 WWW.FREEBUF.COM All Rights Reserved
???滬ICP備13033796號(hào)
|
滬公安網(wǎng)備
AFL Fixtures and Results - AFL.com.au
Skip to main content
AFL
AFLW
AFL Play
Club Sites
Adelaide Crows
Adelaide Crows
Brisbane
Brisbane
Carlton
Carlton
Collingwood
Collingwood
Essendon
Essendon
Fremantle
Fremantle
Geelong
Geelong
Gold Coast Suns
Gold Coast Suns
GWS Giants
GWS Giants
Hawthorn
Hawthorn
Melbourne
Melbourne
North Melbourne
North Melbourne
Port Adelaide
Port Adelaide
Richmond
Richmond
St Kilda
St Kilda
Sydney Swans
Sydney Swans
West Coast Eagles
West Coast Eagles
Western Bulldogs
Western Bulldogs
Created by Telstra
More from Telstra
Australia's best network.
AFL Tipping
AFL Fantasy
Telstra
Telstra TV
Telstra TV Box Office
Foxtel From Telstra
AFL Logo
Latest
News
Videos
Podcasts
Gallery
Matches
Fixture
Ladder
Teams
Broadcast Guide
Match Videos
Stats
AFL Stats
Team Rankings
Premiership Winners
Brownlow Medal
Leaders & Awards
AFL On Demand
Tickets
Buy Tickets
On-Sale Dates
FAQ
Venues
Membership
Fantasy
Play AFL Fantasy
Fantasy Hub
Fantasy Draft
Tipping
Shop
AFL Logo
Menu
Video
Match Centre
Ladder
Stats
Latest
News
Videos
Podcasts
Gallery
Matches
Fixture
Ladder
Teams
Broadcast Guide
Match Videos
Stats
AFL Stats
Team Rankings
Premiership Winners
Brownlow Medal
Leaders & Awards
AFL On Demand
Tickets
Buy Tickets
On-Sale Dates
FAQ
Venues
Membership
Fantasy
Play AFL Fantasy
Fantasy Hub
Fantasy Draft
Tipping
Shop
VFL/VFLW
SANFL
WAFL
AFLW
PLAY AFL
About AFL
VFL/VFLW hub
SANFL hub
WAFL hub
Trade
Draft
Toyota AFL Club Help
Competitions & Promotions
Concussion
Mental Health & Wellbeing
Diversity & Inclusion
AFL Mint
Marvel Stadium
AFL Policies
Annual Reports
Careers
Contact Us
Clubs
Adelaide Crows
Adelaide Crows
Brisbane
Brisbane
Carlton
Carlton
Collingwood
Collingwood
Essendon
Essendon
Fremantle
Fremantle
Geelong
Geelong
Gold Coast Suns
Gold Coast Suns
GWS Giants
GWS Giants
Hawthorn
Hawthorn
Melbourne
Melbourne
North Melbourne
North Melbourne
Port Adelaide
Port Adelaide
Richmond
Richmond
St Kilda
St Kilda
Sydney Swans
Sydney Swans
West Coast Eagles
West Coast Eagles
Western Bulldogs
Western Bulldogs
VFL/VFLW
SANFL
WAFL
AFLW
PLAY AFL
About AFL
VFL/VFLW hub
SANFL hub
WAFL hub
Trade
Draft
Toyota AFL Club Help
Competitions & Promotions
Concussion
Mental Health & Wellbeing
Diversity & Inclusion
AFL Mint
Marvel Stadium
AFL Policies
Annual Reports
Careers
Contact Us
Clubs
Adelaide Crows
Adelaide Crows
Brisbane
Brisbane
Carlton
Carlton
Collingwood
Collingwood
Essendon
Essendon
Fremantle
Fremantle
Geelong
Geelong
Gold Coast Suns
Gold Coast Suns
GWS Giants
GWS Giants
Hawthorn
Hawthorn
Melbourne
Melbourne
North Melbourne
North Melbourne
Port Adelaide
Port Adelaide
Richmond
Richmond
St Kilda
St Kilda
Sydney Swans
Sydney Swans
West Coast Eagles
West Coast Eagles
Western Bulldogs
Western Bulldogs
Follow us on social media
Youtube
TikTok
McDonalds Match Centre
Toyota AFL Premiership Season Fixture
FULL FIXTURE: Download the complete 2024 Toyota AFL Premiership Season Fixture
Download PDF
Naming Rights Partner
Logo of partner Toyota
Major Partners
Logo of partner McDonalds
Logo of partner Telstra footer
Logo of partner Carlton Draught
Logo of partner Nab
View All Partners
Download the Official AFL App
Download on the app store
Google play
Youtube
TikTok
Page Top
AFL Logo
? 2024 AFL
Terms of Use
Privacy Policy
More AFL
About AFL
Mental Health & Wellbeing
Toyota AFL Club Help
Diversity & Inclusion
Contact Us
Get Involved
Play.AFL
Coach.AFL
Umpire.AFL
Schools.AFL
AFL Membership
Acknowledgement of Country
In the spirit of reconciliation the AFL acknowledges the Traditional Custodians of country throughout Australia and their connections to land, sea and community. We pay our respect to their Elders past and present and extend that respect to all Aboriginal and Torres Strait Islander peoples today.
Created by Telstra
Contact Us
Terms and Conditions
Privacy Policy
Copyright & Trademark
Online Security
Why not share?
Close
Share this Stream
Share on Facebook
Share on Twitter
Share on WhatsApp
Copy link
Copied to clipboard!
Share #AFL
Share this article
Loading Gallery
Close
Why not share?
Close
Share This Article
Share on Facebook
Share on Twitter
Share on WhatsApp
Copy link
Copied to clipboard!
Share
Share this article
Up Next
Autoplay
AFLFOX SCORESAFLCricketFootballMotorsportNRLNetballRugbyTennisBasketballGolfNHLUS SportsAFLAFLCompleteSYD12.14.86MEL9.10.64Match CentreAFLCompleteBRI12.13.85CAR13.8.86Match CentreAFL9/3 16:20 AESTGCS–RIC–Match CentreAFL9/3 19:30 AESTGWS–COL–Match CentreAFL14/3 19:30 AESTCAR–RIC–AFL15/3 19:40 AESTCOL–SYD–AFL16/3 13:45 AESTESS–HAW–AFL16/3 16:35 AESTGWS–NM–AFL16/3 19:30 AESTGEE–STK–AFL16/3 20:10 AESTGCS–ADE–AFL17/3 13:00 AESTMEL–WBD–AFL17/3 16:00 AESTPOR–WCE–AFL17/3 18:50 AESTFRE–BRI–Go to AFL Scores
SportsAFLNRLNetballFootballCricketMotorsportRugbyBasketballUFCGolfTennisNFLBoxingWWEHorse RacingeSportsBaseballSurfingNHLCyclingFantasy SportMore SportsVideoAll SportsShowsScoresFantasyGet KayoLive SportsSportsMailVenue FinderPodcastsThe LabOpinionAFLLive StreamLatest NewsPointsbetLive ScoresLadderFixtures & ResultsVideoStatsTeamsTeamsAdelaideBrisbaneCarltonCollingwoodEssendonFremantleGeelongGold CoastGWS GiantsHawthornMelbourneNorth MelbournePort AdelaideRichmondSt KildaSydneyWest CoastWestern BulldogsAFLWAFLWAFLWLive StreamFixtures & ResultsLadderAFLW TeamsAFL TippingAFLW TeamsAdelaide CrowsBrisbane LionsCarltonCollingwoodFremantleGeelong CatsGWS GiantsMelbourneNorth MelbourneWestern BulldogsNRLLive StreamLatest NewsTABLive ScoresVideoLadderNRL PremiershipNRL PremiershipLatest NewsStatsState of OriginNRLWNRLWLive StreamTeamsTeamsBroncosBulldogsCowboysDragonsEelsKnightsPanthersRabbitohsRaidersRoostersSea-EaglesSharksStormTigersTitansWarriorsWinFixtures & ResultsPlayersRLWCNRL TippingNetballLatest NewsFixtures & ResultsVideoLive StreamFootballLive StreamLatest NewsVideoFIFA World CupFIFA World Cup LadderBet NowEPLSocceroosMatildasUEFA Champions LeagueBundesligaSerie AA-LeagueAsian Champions LeagueTransfersFixtures & ResultsLive ScoresW-LeagueLigue 1E-LeagueOpinionEPLLive StreamVideosLatest NewsFixtures & ResultsLadderSocceroosLive StreamVideoSocceroos Team SelectorLatest NewsFixtures & ResultsSocceroos Team SelectorMatildasLive StreamLatest NewsUEFA Champions LeagueLive StreamVideoLatest NewsLadderFixtures & ResultsBundesligaLive StreamLatest NewsFixtures & ResultsLadderSerie ALive StreamLatest NewsFixtures & ResultsLadderA-LeagueTeamsVideoLadderFixtures & ResultsStatsTeamsAdelaide UnitedBrisbane RoarCentral Coast MarinersMelbourne CityMelbourne VictoryNewcastle JetsPerth GlorySydney FCWellington PhoenixWestern Sydney WanderersWestern UnitedMacarthur BullsAsian Champions LeagueLive StreamVideoLatest NewsFixtures & ResultsW-LeagueLive StreamVideoLatest NewsFixtures & ResultsLadderLigue 1Live StreamE-LeagueVideoLatest NewsLive & On DemandWhat is the E-League?Official RulesCompetitorsCricketLive StreamLatest NewsVideoLive ScoresFixtures & ResultsLaddersCricket World CupAustraliaSheffield ShieldMarsh One Day CupBig BashThe AshesWBBLIndian Premier LeagueCricket World CupLive StreamLatest NewsLadderFixtures & ResultsAustraliaIndiaEnglandAustraliaLive StreamVideoLatest NewsSheffield ShieldLive StreamLatest NewsFixtures and ResultsLadderMarsh One Day CupLive StreamVideoFixtures & ResultsBig BashLive StreamVideoLadderLatest NewsFixtures & ResultsSuperCoach BBLSuperCoach NewsThe AshesLive StreamLatest NewsVideoFixtures & ResultsWBBLLive StreamVideoLadderLatest NewsFixtures & ResultsIndian Premier LeagueLatest NewsLadderMotorsportLive StreamLatest NewsAustralian GP 2023Formula 1SupercarsMotoGPSchedule & ResultsVideoFormula 1Live StreamVideoSchedule & ResultsLatest NewsSupercarsLive StreamVideoStandingsSchedule & ResultsLatest NewsMotoGPLive StreamVideoLatest NewsSchedule & ResultsStandingsRugbyLatest NewsVideoWorld CupBledisloe CupWallabiesTri NationsSuper RugbySuper WFixtures & ResultsBledisloe CupLatest NewsWallabiesVideoFixtures & ResultsLatest NewsTri NationsLadderSuper RugbyLatest NewsTeamsTeamsBluesBrumbiesBullsChiefsCrusadersHighlandersHurricanesJaguaresLionsRebelsRedsSharksStormersSunwolvesWaratahsPlayersLadderFixtures & ResultsLive ScoresLine UpsStatsSuper WVideoLatest NewsBasketballLive StreamVideoLatest NewsBet NowNBANBLWNBLPodcastsFixtures & ResultsLive ScoresNBALive StreamVideoLatest NewsPodcastsFixtures & ResultsBet NowNBLLive StreamVideoLatest NewsFixures & ResultsWNBLLive StreamVideoLatest NewsUFCLive StreamVideoLatest NewsPodcastsGolfLive StreamThe Open ChampionshipLatest NewsFixtures & ResultsVideoThe Open ChampionshipLatest NewsLeaderboardTennisLive StreamLatest NewsAustralian OpenUS OpenVideoFixtures & ResultsLive ScoresWimbledonFrench OpenUS OpenLatest NewsWimbledonLive StreamLatest NewsFrench OpenLatest NewsLive StreamNFLLive StreamVideoLatest NewsFixtures & ResultsLive ScoresBet NowBoxingLive StreamVideoWWEVideoLatest NewsLive StreamHorse RacingLive StreamLatest NewsMelbourne CupMelbourne Cup SweepSpring Racing CarnivaleSportsE-LeagueBaseballLive StreamLatest NewsFixtures & ResultsSurfingLive StreamLatest NewsVideoNHLLive StreamFixtures & ResultsLatest NewsCyclingTour de FranceLatest NewsLive StreamTour de FranceLatest NewsMore SportsLatest NewsVideoLive StreamTokyo Olympics 2021Tokyo Olympics 2021Latest NewsScheduleResultsMedal TallyHistoryAthletesRecordsAll SportsLeagueBasketballAFLCricketFootballRugbyOther SportsMotorsportTennisBoxingGolfUFCSponsoredMedia CentreLeagueNRLSuper LeagueState of OriginMatty JohnsNRL 360TestsRugby LeagueNRLPress ConferencesMatty JohnsFletch and HindyTestsHighlightsFull MatchesBasketballNBANBLWNBLAFLAFLPress ConferencesBuddy 300AFL TonightAFL 360BounceCricketAustraliaBig BashCricketT20Cricket World CupIPLThe AshesDomestic CricketAustraliaExtended HighlightsDomestic CricketOne-Day CupSheffield ShieldFootballEPLA-LeagueWomen's World CupAsian CupMatildasUCL and Europa LeagueW-LeagueLa LigaFootballAsian Champions LeagueSerie ARugbySuper RugbyWallabiesRugbySponsoredOther SportsNFLOther SportsWWENetballSurfingHorse RacingOlympicsMotorsportFormula 1SupercarsMotorsportNASCARWRCTennisTennisFrench OpenUS OpenBoxingPress ConferencesBoxingGolfUS OpenGolfMastersPGA ChampionshipBritish OpenRyder CupThe Golf ShowThe Golf ShowThe Golf Show RulesThe Wedge - TipsThe Golf Show GadgetsUFCUFCFight WeekPress ConferencesSponsoredMaccasToyota UnbreakableWarnie 2020Musashi LabAmpolABS CensusBeforePayMacca's Footy Tales4WDSCSummer of Spin 2021BTSMaximus 2022AMB TRAILERTOYOTA COMMUNITY HUBMaccas Classics 2024 ShowsAFL 360Back Page LiveBill & BozBig League WrapMatty JohnsNRL TonightNRL 360The Fan
Fox sportsScores
AFLLive StreamLatest NewsPointsbetLive ScoresLadderFixtures & ResultsVideoStatsTeamsAFLWAFL Tipping
Homeafl
AFL‘What are we seeing!?’ Blues’ ‘ridiculous’ 46-pt comeback in fiery thriller: AFL LIVE
LIVE: After an unthinkable 46-point comeback, the Blues and Lions are set to fight out a see-sawing final quarter in an Opening Round thriller.
AFLDual blow amid stack of scares for stars in AFL injury carnage
Keidean Coleman and Sam Docherty were both subbed out of the clash, while several others had scares in a brutal opening half.
AFLClarko hit with huge penalty over ‘unacceptable, highly inappropriate’ Saints spray
North Melbourne coach Alastair Clarkson has been sanctioned by the AFL for his fiery exchange with St Kilda players last weekend.
AFL‘Significant interest’ for selfless Swan; Vic rival ‘really aggressive’ in hunt for Bulldog — Whispers
An unheralded Swan has earned a great’s praise amid reports he’s garnered “significant interest” from around the competition, while another report has emerged about an off-contract Bulldog.
Opening Round
AFL VIDEOSClarkson to "reinvent" after altercation2:30AFL CEO won't commit to Opening Round0:52Grundy soars for new club Swans2:26Darcy Moore: Journey From Grassroots2:38Grundy praises brand new Swans life6:04Van Rooyen sinks bicycle kick stunner?!0:41
MORE AFL VIDEOS
MORE AFL NEWSAFL‘He got me’: Star recruit wins big battle as Swans revel in ‘greatest ever list free hit’
Brodie Grundy issued an ominous statement against his former side on Thursday night, employing a smart ruck tactic to wear down his ex-Melbourne Demons teammate.
AFLControversial former AFL star dead at 69
Considered by some as a villain of the game, he scored 92 goals in his more than a decade-long career.
AFL‘Interesting conversations’: Unlikely Swans hero amid injury crisis to spark selection conundrum
Amid critical injuries to a star trio, has Sydney unearthed an unlikely ball-winning saviour?
AFLHow brutal post-GF loss chat let Lions dump their ‘luggage’... and prepped them for revenge
A few weeks after a nail biting loss to Collingwood in last year’s grand final, Harris Andrews and his partner packed their bags and headed overseas for the first time since COVID-19 hit. The trip could not come quickly enough for the Lions skipper.
(Frame content direct link: https://omny.fm/shows/fox-footy-podcasts/playlists/podcast/embed?style=cover.)MORE AFL STORIESAFL‘Unbelievable’ trade bargain monsters mate as grudge match a Swans statement: 3-2-1
Brodie Grundy got the points on Max Gawn and his old side in an ominous statement from the reborn ruckman as the Swans downed Melbourne by 22 points in the AFL’s season opener.
AFL‘Worst pain I’ve ever felt’: Swans’ superstar’s big day finished in style... but it started horribly
Brodie Grundy got a taste of both the good and bad of Sydney on Thursday, making a spectacular debut for the Swans at the SCG - and copping a gruesome injury before the game.
AFLPremiership Pie axed, Blues’ ruck surprise as Tiger ends 1353-day drought: AFL Teams
OPENING ROUND TEAMS: Collingwood has named a debutant but dropped a Grand Final hero, while Richmond names a recruit for his first game in almost four years.
AFLFears of ‘wasted’ dynasty‘ as big question mark hangs over AFL heavyweight
Stunning trade whispers, ‘drug culture’ questions and a shock pre-season retirement — all after consecutive straight sets finals exits — have pundits split on this star-studded AFL contender.
AFLW NewsAFL‘Wholesome’ drug test catch-up and ‘euphoric’ surge: AFLW star on her ‘most chaotic, emotional year’
AFLW star Chloe Molloy says the last 12 months have been the “most chaotic and emotional” of her life following her high-profile move from Collingwood to Sydney.
AFLLaidley’s comeback on hold as Dogs announce new AFLW coach
Dani Laidley’s coaching comeback is on hold after she was edged out for the Western Bulldogs job by an untried contender.
AFLLions sanctioned after missed text message causes concussion rule breach late in GF
The Brisbane Lions have been sanctioned for a “non-deliberate” breach of the AFL concussion protocols during their thrilling Grand Final win over North Melbourne.
AFLLaidley in mix.. but premiership coach return likely; Hawks ponder lifeline for great: Coach whispers
A former premiership coach could reclaim his old job at the Western Bulldogs as Hawthorn also mulls a comeback coach.
AFLDogs land huge haul, wild 1969 connection to Cats’ pick as 53 players live dream at AFLW Draft
Key forward Kristie-Lee Weston-Turner became the latest AFLW No.1 pick, as the Western Bulldogs had a busy night at the 2023 national draft.
XA NOTE ABOUT RELEVANT ADVERTISING: We collect information about the content (including ads) you use across this site and use it to make both advertising and content more relevant to you on our network and other sites. This is also known as Online Behavioural Advertising. Find out more about our policy and your choices, including how to opt-out.SubscribeGet Kayo SportsSign up to SportsmailGet FoxtelGet Foxtel BroadbandSportsAFLNRLFootballCricketMotorsportRugbyNFLBasketballTennisGolfpunters.com.auContactAbout FOX SPORTS AustraliaContact UsCareersOn Air CareSportsTGAdvertisingAdvertise with usAdvertising Preferences & Opt-outsPolicyPrivacy PolicyCookies PolicyTerms and ConditionsAccessibilitySitemapRSS FeedsNewsCorpnews.com.auThe AustralianThe Daily TelegraphHerald SunThe Courier-MailThe AdvertiserPerth NowNT NewsHIPAGESStay connected on social mediaFox Sports Australia?2024??
<AFL++學(xué)習(xí)日志(一)開(kāi)始Fuzz與crashes分析 - Hanyin's Space
Hanyin's Space
Home
Archives
Tags
RSS
About
Links
March 12, 2021 pm
3k 字
17 mins
AFL++學(xué)習(xí)日志(一)開(kāi)始Fuzz與crashes分析
Last updated on 2022-05-29T16:48:43+08:00
前言
American Fuzzy Lop plus plus (afl++)是一個(gè)由社區(qū)驅(qū)動(dòng)的開(kāi)源工具,它結(jié)合了最新的模糊研究,使研究具有可比性,可重復(fù)性,可組合性,并且-最重要的是-可用的
。它提供了多種新功能,例如,Custom Mutator API
(傳統(tǒng)的突變API)能夠增加模糊測(cè)試處理策略,特定目標(biāo)的變異也可以由經(jīng)驗(yàn)豐富的安全測(cè)試人員編寫。具體細(xì)節(jié)可以參閱AFL++
: Combining Incremental Steps of Fuzzing Research。
本文主要介紹如何使用AFL++快速開(kāi)始Fuzz一個(gè)樣例程序和對(duì)大量的Fuzzer-Generated
Crashes進(jìn)行分類以及部分工具的安裝與使用,如有錯(cuò)漏,也請(qǐng)師傅們不吝賜教。
AFL++的安裝
American Fuzzy Lop plus plus (afl++) Release Version: 3.14c Github
Version: 3.15a Repository: https://github.com/AFLplusplus/AFLplusplus
Doc: https://aflplus.plus/
最簡(jiǎn)單的當(dāng)然就是使用Docker啦,直接一鍵pull就可以使用了,具體請(qǐng)參見(jiàn)Dockerfile(一般情況下都?jí)蛴昧?
12docker pull aflplusplus/aflplusplusdocker run -ti -v /location/of/your/target:/src aflplusplus/aflplusplus
或者手動(dòng)安裝依賴后下載源碼編譯構(gòu)建。(建議下載最新版本的編譯器)
12sudo apt-get install git build-essential curl libssl-dev sudo libtool libtool-bin libglib2.0-dev bison flex automake python3 python3-dev python3-setuptools libpixman-1-dev gcc-9-plugin-dev cgroup-tools \clang-12 clang-tools-12 libc++-12-dev libc++1-12 libc++abi-12-dev libc++abi1-12 libclang-12-dev libclang-common-12-dev libclang-cpp12 libclang-cpp12-dev libclang1-12 liblld-12 liblld-12-dev liblldb-12 liblldb-12-dev libllvm12 libomp-12-dev libomp5-12 lld-12 lldb-12 llvm-12 llvm-12-dev llvm-12-linker-tools llvm-12-runtime llvm-12-tools python3-lldb-12
有時(shí)你可能需要切換下軟件的默認(rèn)版本。
1234sudo update-alternatives --install /usr/bin/clang clang `which clang-12` 0sudo update-alternatives --install /usr/bin/clang++ clang++ `which clang++-12` 0sudo update-alternatives --install /usr/bin/llvm-config llvm-config `which llvm-config-12` 0sudo update-alternatives --install /usr/bin/llvm-symbolizer llvm-symbolizer `which llvm-symbolizer-12` 0
獲取源碼并編譯安裝。
12345git clone https://github.com/AFLplusplus/AFLpluspluscd AFLplusplusgit checkout stable # 選擇安裝版本,默認(rèn)為stablemake distrib # 安裝包括qemu_mode, unicorn_mode等在內(nèi)的所有模式sudo make install
make構(gòu)建目標(biāo)選擇:
all: just the main AFL++ binaries
binary-only: everything for binary-only fuzzing: qemu_mode,
unicorn_mode, libdislocator, libtokencap
source-only: everything for source code fuzzing: instrumentation,
libdislocator, libtokencap
distrib: everything (for both binary-only and source code
fuzzing)
man: creates simple man pages from the help option of the
programs
install: installs everything you have compiled with the build
options above
clean: cleans everything compiled, not downloads (unless not on a
checkout)
deepclean: cleans everything including downloads
code-format: format the code, do this before you commit and send a
PR please!
tests: runs test cases to ensure that all features are still working
as they should
unit: perform unit tests (based on cmocka)
help: shows these build options
構(gòu)建選項(xiàng):
STATIC - compile AFL++ static
ASAN_BUILD - compiles with memory sanitizer for debug purposes
DEBUG - no optimization, -ggdb3, all warnings and -Werror
PROFILING - compile with profiling information (gprof)
INTROSPECTION - compile afl-fuzz with mutation introspection
NO_PYTHON - disable python support
NO_SPLICING - disables splicing mutation in afl-fuzz, not
recommended for normal fuzzing
AFL_NO_X86 - if compiling on non-intel/amd platforms
LLVM_CONFIG - if your distro doesn't use the standard name for
llvm-config (e.g. Debian)
安裝完成后的系統(tǒng)配置:
12sudo ~/AFLplusplus/afl-system-config #將降低系統(tǒng)的安全性,建議僅在docker中使用ulimit -c 0 # 當(dāng)程序crash時(shí)不產(chǎn)生core文件,在存在大量crashes的時(shí)候特別有用
開(kāi)始Fuzzing
相信很多人在剛開(kāi)始的時(shí)候都會(huì)有下面兩個(gè)問(wèn)題(包括我) 1.
不熟悉模糊測(cè)試工具; 2. 用模糊測(cè)試測(cè)試什么內(nèi)容
對(duì)于第一點(diǎn),建議參閱FuzzingBook和Sakura師傅的AFL源碼注釋,至于第二個(gè),我建議的選擇是類似于afl-training或者EkoParty_Advanced_Fuzzing_Workshop等學(xué)習(xí)類型的target,也是本系列文章的主要內(nèi)容部分(后續(xù)實(shí)戰(zhàn)目標(biāo)的選擇可以看我的博客)。
Fuzzing with AFL workshop Repository:
https://github.com/mykter/afl-training Doc:
https://github.com/mykter/afl-training/files/5454345/Fuzzing.with.AFL.-.GrayHat.2020.pdf
Docker: https://ghcr.io/mykter/fuzz-training
測(cè)試代碼可以在此下載,核心函數(shù)代碼如下:
123456789101112131415161718192021222324252627282930313233343536373839404142434445int process(char *input){ char *out; char *rest; int len; if (strncmp(input, "u ", 2) == 0) { // upper case command char *rest; len = strtol(input + 2, &rest, 10); // how many characters of the string to upper-case rest += 1; // skip the first char (should be a space) out = malloc(len + strlen(input)); // could be shorter, but play it safe if (len > (int)strlen(input)) /* skip */ for (int i = 0; i != len; i++) { char c = rest[i]; if (c > 96 && c < 123) // ascii a-z { c -= 32; } out[i] = c; } out[len] = 0; strcat(out, rest + len); // append the remaining text printf("%s", out); free(out); } else if (strncmp(input, "head ", 5) == 0) { // head command if (strlen(input) > 6) { len = strtol(input + 4, &rest, 10); rest += 1; // skip the first char (should be a space) rest[len] = '\0'; // truncate string at specified offset printf("%s\n", rest); } /* skip */ } else if (strcmp(input, "surprise!\n") == 0) { // easter egg! *(char *)1 = 2; } /* skip */}
使用afl-clang-fast進(jìn)行編譯,如提示命令未找到就將AFL++目錄添加至PATH環(huán)境變量。
1afl-clang-fast -AFL_HARDEN=1 vulnerable.c -o vulnerable
優(yōu)先選擇更好的插樁方式,若使用afl-cc會(huì)自動(dòng)選擇最合適的編譯器。
123456789101112131415161718192021222324+--------------------------------+| clang/clang++ 11+ is available | --> use LTO mode (afl-clang-lto/afl-clang-lto++)+--------------------------------+ see [instrumentation/README.lto.md](instrumentation/README.lto.md) | | if not, or if the target fails with LTO afl-clang-lto/++ | v+---------------------------------+| clang/clang++ 3.8+ is available | --> use LLVM mode (afl-clang-fast/afl-clang-fast++)+---------------------------------+ see [instrumentation/README.llvm.md](instrumentation/README.llvm.md) | | if not, or if the target fails with LLVM afl-clang-fast/++ | v +--------------------------------+ | gcc 5+ is available | -> use GCC_PLUGIN mode (afl-gcc-fast/afl-g++-fast) +--------------------------------+ see [instrumentation/README.gcc_plugin.md](instrumentation/README.gcc_plugin.md) and [instrumentation/README.instrument_list.md](instrumentation/README.instrument_list.md) | | if not, or if you do not have a gcc with plugin support | v use GCC mode (afl-gcc/afl-g++) (or afl-clang/afl-clang++ for clang)
設(shè)置AFL_HARDEN會(huì)讓調(diào)用的下游編譯器自動(dòng)化代碼加固,使得檢測(cè)簡(jiǎn)單的內(nèi)存bug變得更加容易,但會(huì)減少5%左右的性能,關(guān)于AFL++的環(huán)境變量設(shè)置可以參閱https://aflplus.plus/docs/env_variables/。
使用afl-fuzz進(jìn)行Fuzz,輸入可以隨意寫,如echo 1 > inputs/1,或帶有源碼中關(guān)鍵字的輸入(推薦),如echo "u 4 capsme" > inputs/2,但需保證輸入必須能使程序正常運(yùn)行(即不能一開(kāi)始就整個(gè)crash)。
12345mkdir inputsmkdir outecho 1 > inputs/1echo "u 4 capsme" > inputs/2afl-fuzz -i inputs -o out ./vulnerable
如果一切正常的話,睡個(gè)午覺(jué)之后你就能看見(jiàn)類似于如下的圖:
每個(gè)獨(dú)特的crash和命令參數(shù)都將存放在輸出文件夾的crashes文件夾下,接下來(lái)就是對(duì)這些crash進(jìn)行調(diào)試分析了。
crashes分類與自動(dòng)化分析
在開(kāi)始分析前請(qǐng)確保已安裝gdb等常用二進(jìn)制調(diào)試工具,我使用的是GDB的gef插件。
對(duì)crashes的分類包括調(diào)試分析Fuzz程序發(fā)現(xiàn)的每個(gè)crash以確定碰撞是否值得進(jìn)一步分析(對(duì)安全研究人員而言,這通常意味著確定crash是否可能是由漏洞造成的),如果是,則確定crash的根本原因。詳細(xì)地人工分析每一個(gè)crash都非常耗時(shí)耗力,尤其當(dāng)Fuzzer已經(jīng)識(shí)別出幾十次或上百次crash時(shí)。
幸運(yùn)的是現(xiàn)在已有許多可用于幫助分類或分析crash的技術(shù)和工具。雖然crashes的分類仍然可能是一個(gè)痛苦的過(guò)程,但下述的工具可以幫助減輕一些乏味的工作,至少也能大概確定最有可能觸發(fā)安全相關(guān)問(wèn)題的crash優(yōu)先級(jí)。
crash復(fù)現(xiàn)與初步分析
首先我們來(lái)看看剛才得到的九個(gè)crash(這里只有八個(gè)的原因是我服務(wù)器崩了導(dǎo)致我重跑了一遍,但第九個(gè)crash怎么也出不來(lái)。。。。。。。。)
我們先用gdb簡(jiǎn)單調(diào)試下:
顯然,我們能知道錯(cuò)誤類型(在這種情況下為SIGSEV),發(fā)生錯(cuò)誤的代碼行(因?yàn)槎M(jìn)制文件是帶調(diào)試信息編譯的),造成崩潰的指令(movdqu xmm2, XMMWORD PTR [r13+rdi*1+0x11],大概率是因?yàn)榉欠ㄔL問(wèn)內(nèi)存),backtrace以及其他諸如stack內(nèi)容等信息。但逐個(gè)這樣分析crash是一件很費(fèi)時(shí)費(fèi)力的工作,所以我們需要一些自動(dòng)化工具來(lái)幫助我們進(jìn)行分析。
自動(dòng)化工具的介紹和使用
GDB 'exploitable' plugin Repository:
https://github.com/jfoote/exploitable
exploitable是一個(gè)gdb插件,安裝請(qǐng)參見(jiàn)安裝文檔,它試圖確定某個(gè)特定的crash是否可能可以被利用。該插件為各類程序狀態(tài)提供了一系列的分類標(biāo)準(zhǔn),如果程序處于可以被插件識(shí)別的狀態(tài),它將為該狀態(tài)分配可利用性的分類。使用如下:
此工具可以幫助用戶優(yōu)先分析那些最有可能被利用的crash,不太可能被利用的(或者插件無(wú)法分析的)可能仍然值得分析,但這是在調(diào)試了那些更有希望發(fā)現(xiàn)漏洞的crash之后。
crashwalk Repository: https://github.com/bnagy/crashwalk Doc:
https://pkg.go.dev/github.com/bnagy/crashwalk
Crashwalk是在exploitable插件基礎(chǔ)上開(kāi)發(fā)的一款工具。Crashwalk將遍歷AFL生成的crashes并在crash狀態(tài)下運(yùn)行exploitable并生成一個(gè)crashwalk.db文件。
使用方法:
12export CW_EXPLOITABLE=/path/to/exploitable.py./cwtriage -root ./out/default/crashes/ -match id -- ./vulnerable
使用cwdump獲取摘要:
1./cwdump ./crashwalk.db
afl-utils Repository: https://gitlab.com/rc0r/afl-utils Docs:
https://gitlab.com/rc0r/afl-utils/-/tree/master/docs
含有一系列協(xié)助Fuzzing的工具集合:
自動(dòng)crash樣本收集,驗(yàn)證,過(guò)濾和分析(afl-collect,afl-vcrash)
輕松管理并行(多核)Fuzz測(cè)試作業(yè)(afl-multicore,afl-multikill)
語(yǔ)料庫(kù)優(yōu)化(afl-minimize)
Fuzz狀態(tài)統(tǒng)計(jì)監(jiān)督(afl-stats)
Fuzzer隊(duì)列同步(afl-sync)
自主實(shí)用程序執(zhí)行(afl-cron)
其中afl-collect與crashwalk類似,也可調(diào)用exploitable進(jìn)行簡(jiǎn)單分析并生成庫(kù),具體上篇文章已經(jīng)介紹過(guò)了,不再贅述,直接上圖:
可以看出afl-collect很快就統(tǒng)計(jì)了腳本數(shù)據(jù)并將crashes整合后復(fù)制到了輸出文件夾,對(duì)比crashwalk的結(jié)果而言簡(jiǎn)明了很多。但需要注意的是,exploitable并沒(méi)有考慮在現(xiàn)有防御機(jī)制下漏洞的利用難度,所以我們還需要使用下述工具來(lái)輔助我們進(jìn)行分析。
AFL crash exploration mode Repository:
https://github.com/AFLplusplus/AFLplusplus#help-crash-triage Reference:
https://lcamtuf.blogspot.com/2014/11/afl-fuzz-crash-exploration-mode.html
這是一種內(nèi)置于AFL中的模式,F(xiàn)uzzer將一個(gè)或多個(gè)導(dǎo)致crash的測(cè)試用例作為輸入,并使用其feedback-driven
fuzzing策略在保持crash的情況下快速枚舉程序中可以到達(dá)的所有代碼路徑。
一般而言,我們希望Fuzzer找到更多獨(dú)特的crash而不是一次又一次的同類crashes。然而,正如文檔中所指出的,這種模式的目的是創(chuàng)建一個(gè)小的crashes庫(kù)從而可以快速地檢查它來(lái)分析我們對(duì)漏洞的控制程度。例如,如果crash與寫入地址有關(guān),但我們無(wú)法控制該地址,那么這個(gè)就可能不是那么有用。另一方面,如果AFL的crash
exploration模式確定我們可以通過(guò)更改輸入來(lái)對(duì)任意地址執(zhí)行寫操作,那么我們就更有可能利用這個(gè)漏洞進(jìn)行攻擊。
我們將使用afl-fuzz生成的初始崩潰用例來(lái)啟用崩潰探索模式,即將crashes目錄作為輸入并使用-C運(yùn)行afl-fuzz:
1afl-fuzz -C -i out/default/crashes/ -o crash_exploration/ ./vulnerable
當(dāng)AFL開(kāi)始以這種模式運(yùn)行時(shí),它將檢查測(cè)試用例以確保它們導(dǎo)致crash,如下所示:
在AFL的正常模式中,此步驟的目的是對(duì)測(cè)試用例進(jìn)行檢查以確保它們不會(huì)導(dǎo)致崩潰。AFL希望使用正常的測(cè)試文件來(lái)使程序按預(yù)期方式運(yùn)行,以便可以對(duì)它們進(jìn)行迭代以觸發(fā)異常行為。相反,崩潰探索模式確保這些測(cè)試用例已經(jīng)導(dǎo)致crash,因?yàn)樗鼘L試識(shí)別將導(dǎo)致相同狀態(tài)的其他代碼路徑。
Record and Replay Framework Repository:
https://github.com/rr-debugger/rr Doc: https://rr-project.org/ Wiki:
https://github.com/rr-debugger/rr/wiki Reference: Engineering Record And
Replay For Deployability Extended Technical Report
需要Linux內(nèi)核3.11或更高版本且/proc/sys/kernel/perf_event_paranoid必須小于等于1(即能夠使用perf計(jì)數(shù)器)。詳細(xì)要求請(qǐng)參閱https://github.com/rr-debugger/rr/wiki/Building-And-Installing#hardwaresoftware-configuration
。我的服務(wù)器不符合要求,就在這里僅做個(gè)介紹推薦吧,有空再補(bǔ)(咕了
對(duì)crash的簡(jiǎn)單調(diào)試
讓我們從上面分完類的crashes中隨機(jī)挑一個(gè)丟到gdb里去,在strcat(out, rest + len);處下個(gè)斷點(diǎn)(當(dāng)然在其他地方也可以,主要是這里的溢出點(diǎn)太明顯了。。。。)
heap-view
可以看出來(lái)在執(zhí)行strcat函數(shù)之前的堆還是十分正常的
heap-chunks
oops,溢出啦,讓我們來(lái)看一下輸入文件的內(nèi)容
顯然是因?yàn)閟trcat造成溢出覆蓋了top
chunk,然后在printf調(diào)用malloc的時(shí)候觸發(fā)crash。而輸入我們是可以自定義的,也就是說(shuō)我們現(xiàn)在可以控制top
chunk的size了,接下來(lái)的利用過(guò)程就交給各位師傅們了。
總結(jié)
在本文中我們介紹了AFL++的安裝和各類工具的使用以幫助我們對(duì)Fuzzer生成的crashes進(jìn)行分類與分析。當(dāng)然,還有很多自動(dòng)化分析工具沒(méi)有介紹,具體可以參閱https://aflplus.plus/docs/sister_projects/#crash-triage-coverage-analysis-and-other-companion-tools。
在下篇文章中我會(huì)學(xué)著如何對(duì)一些簡(jiǎn)單的庫(kù)代碼和真實(shí)軟件編寫harness來(lái)幫助Fuzzer更好地進(jìn)行Fuzzing。
#Security
#Fuzzing
#模糊測(cè)試
#AFL++
AFL++學(xué)習(xí)日志(一)開(kāi)始Fuzz與crashes分析
https://mundi-xu.github.io/2021/03/12/Start-Fuzzing-and-crashes-analysis/
Author
寒雨
Posted on
March 12, 2021
Licensed under
利用AFL fuzz PDFium
Previous
華為鯤鵬服務(wù)器下MySQL8的安裝與遠(yuǎn)程連接配置
Next
Please enable JavaScript to view the comments
Table of Contents
Search
×
Keyword
Contact me [email protected]
總訪問(wèn)量
次
總訪客數(shù)
人
Blog works best with JavaScript enabled
模糊測(cè)試工具 AFL的原理與實(shí)踐 - 知乎首發(fā)于安全領(lǐng)域入個(gè)門吧切換模式寫文章登錄/注冊(cè)模糊測(cè)試工具 AFL的原理與實(shí)踐剪水作花飛件件都能,一無(wú)所長(zhǎng)在軟件開(kāi)發(fā)的世界里,質(zhì)量和安全性是評(píng)估產(chǎn)品成敗的重要指標(biāo)。模糊測(cè)試作為一種高效的自動(dòng)化測(cè)試方法,專門用來(lái)發(fā)現(xiàn)程序中的錯(cuò)誤和安全漏洞。本文旨在詳細(xì)介紹 AFL(American Fuzzy Lop)的基本原理和使用方法。一、AFL 的原理介紹模糊測(cè)試是一種通過(guò)向軟件輸入異?;螂S機(jī)數(shù)據(jù)的自動(dòng)化技術(shù),目的是發(fā)現(xiàn)程序在處理意外或邊緣情況輸入時(shí)的錯(cuò)誤。AFL 是這一測(cè)試策略中的杰出代表,它通過(guò)不斷學(xué)習(xí)程序反應(yīng)來(lái)改進(jìn)測(cè)試用例,提高測(cè)試的覆蓋率和發(fā)現(xiàn)漏洞的概率。AFL利用遺傳算法,不斷生成測(cè)試用例,并通過(guò)動(dòng)態(tài)插樁技術(shù)監(jiān)控程序的行為,特別是程序的代碼覆蓋情況。當(dāng)新的輸入能觸發(fā)新的代碼路徑時(shí),這個(gè)輸入會(huì)被保存以供進(jìn)一步的測(cè)試。該過(guò)程可以形成一個(gè)反饋循環(huán),不斷優(yōu)化測(cè)試用例以探索更多程序狀態(tài)。下面是 AFL 工作流程圖,展示了從準(zhǔn)備測(cè)試用例到監(jiān)控程序行為的步驟:graph TD
A[Compile with afl-gcc] --> B[Initialize seed corpus] --> C[Fuzzing loop] --> D[Select seed from corpus queue]
D[Select seed from corpus queue] --> E[Mutate selected seed] --> F[Execute with mutated testcase]
F[Execute with mutated testcase] --> G[Monitor for crashes and coverage update] --> H{Check for new coverage}
H{Check for new coverage} -- YES --> I[Save mutated testcase to queue] --> D
H{Check for new coverage} -- NO --> D流程圖詳細(xì)展示了 AFL 在模糊測(cè)試中的核心步驟:編譯(Compile with afl-gcc) - 使用 AFL 提供的編譯器 afl-gcc,對(duì)目標(biāo)程序進(jìn)行編譯,實(shí)現(xiàn)程序的動(dòng)態(tài)插樁。 初始化種子庫(kù)(Initialize seed corpus) - 創(chuàng)建初始測(cè)試用例集(種子庫(kù)),這些測(cè)試用例將作為模糊測(cè)試的起點(diǎn)。 模糊測(cè)試循環(huán)(Fuzzing loop) - 一個(gè)不斷循環(huán)的過(guò)程,根據(jù)測(cè)試結(jié)果更新種子庫(kù),并反復(fù)執(zhí)行下列子步驟: a. 選擇種子(Select seed from corpus queue) - 從種子庫(kù)中選擇一個(gè)種子文件作為當(dāng)前測(cè)試的輸入。 b. 突變種子(Mutate selected seed) - 對(duì)選中的種子文件應(yīng)用突變算法,生成新的測(cè)試用例。 c. 執(zhí)行測(cè)試(Execute with mutated test case) - 將變異后的測(cè)試用例作為輸入執(zhí)行已插樁的目標(biāo)程序。 d. 監(jiān)控結(jié)果(Monitor for crashes and coverage update) - 監(jiān)控程序的執(zhí)行情況,記錄崩潰和代碼覆蓋率的變化。 覆蓋率檢查(Check for new coverage) - 判斷是否出現(xiàn)新的代碼覆蓋,如果有,則將其保存為新測(cè)試用例。 保存新測(cè)試用例(Save new testcase to queue) - 將觸發(fā)新代碼覆蓋的測(cè)試用例保存到隊(duì)列中,用于后續(xù)的測(cè)試。 AFL采用了fork的運(yùn)行模式,這使得當(dāng)待測(cè)程序出現(xiàn)崩潰時(shí),fuzz進(jìn)程不會(huì)終止,這一點(diǎn)相較于LibFuzzer更具優(yōu)勢(shì)。然而,頻繁的fork操作也導(dǎo)致了AFL的效率不如LibFuzzer。二、AFL安裝和運(yùn)行1. 支持的系統(tǒng)和架構(gòu)AFL設(shè)計(jì)之初主要針對(duì)UNIX-like系統(tǒng),其在Linux系統(tǒng)上有最好的支持。然而,在社區(qū)的努力下,也有Windows版本的AFL,如winafl,其可以在Windows進(jìn)行模糊測(cè)試。AFL還支持多種CPU架構(gòu),其中對(duì)x86和x64架構(gòu)的支持最好。如果要支持ARM架構(gòu),則需要使用AFL的QEMU模式。2. 安裝步驟AFL可以通過(guò)源碼進(jìn)行安裝:apt install git make gcc
git clone https://github.com/google/AFL.git
cd AFL && make3. 運(yùn)行參數(shù)在安裝并編譯完 AFL 之后,可以使用 afl-fuzz 命令來(lái)啟動(dòng)模糊測(cè)試。一個(gè)基本的 AFL fuzz 命令如下:afl-fuzz -i input_dir -o output_dir -- /path/to/program [options] @@這里:afl-fuzz 是啟動(dòng) AFL 模糊測(cè)試的程序。-i input_dir 指定包含初始化測(cè)試用例的目錄。-o output_dir 指定存放的 fuzzing 結(jié)果的目錄。-- 之后的部分是運(yùn)行被測(cè)試程序的命令行,其中 /path/to/program 替換為需要進(jìn)行模糊測(cè)試的程序的路徑,[options] 是運(yùn)行該程序的任何選項(xiàng)或參數(shù)。如果測(cè)試程序需要從文件中讀取輸入,可以在實(shí)際輸入文件路徑的位置使用 @@ 占位符。AFL 將替換 @@ 來(lái)插入它正在測(cè)試的輸入文件。如果省略這個(gè)占位符,AFL 將會(huì)把模糊測(cè)試用例通過(guò) stdin 傳遞給測(cè)試程序。三、AFL的使用示例本節(jié)使用一個(gè)簡(jiǎn)單的示例,演示AFL的操作步驟。這是待測(cè)源碼,其功能是接受一行命令行輸入,進(jìn)行四則運(yùn)算。其中使用了不安全的gets函數(shù),可能導(dǎo)致緩沖區(qū)溢出:#include
#include
int calculate(int a, int b, char op) {
switch (op) {
case '+': return a + b;
case '-': return a - b;
case 'x': return a * b;
case '/': return b ? a / b : 0;
default: return 0;
}
}
int main() {
char input[100];
// unsafe method that may cause buffer overflow
gets(input);
int a, b, result;
char op;
if (sscanf(input, "%d %c %d", &a, &op, &b) != 3)
return 1;
result = calculate(a, b, op);
printf("Result: %d\n", result);
return 0;
}1. 編譯源碼使用AFL的編譯器afl-gcc或afl-clang對(duì)源文件hello.c進(jìn)行編譯,添加所需要的代碼覆蓋插樁。afl-gcc或afl-clang實(shí)際上是對(duì)常規(guī)的gcc或clang編譯器進(jìn)行了封裝,通過(guò)在編譯時(shí)進(jìn)行插樁,來(lái)統(tǒng)計(jì)fuzz過(guò)程中的代碼覆蓋率:afl-gcc -o hello hello.c2. 準(zhǔn)備種子語(yǔ)料庫(kù)不論程序是從file還是從stdin獲取數(shù)據(jù),AFL都需要一個(gè)初始語(yǔ)料庫(kù)來(lái)啟動(dòng)模糊測(cè)試過(guò)程。輸入(無(wú)論是來(lái)自file或stdin)是AFL用來(lái)開(kāi)始探索程序行為的基礎(chǔ)。初始語(yǔ)料庫(kù)(seed corpus)是一組文件,其中包含了各種有效的輸入示例,這些輸入會(huì)被AFL用作模糊測(cè)試的起始點(diǎn)。從stdin讀取輸入時(shí),AFL會(huì)將語(yǔ)料庫(kù)中的每個(gè)文件內(nèi)容作為輸入在每次測(cè)試運(yùn)行時(shí)送到程序的標(biāo)準(zhǔn)輸入流中。使用AFL時(shí),必須要有初始語(yǔ)料庫(kù)。注意這一點(diǎn)AFL與Libfuzzer不同,Libfuzzer只接受stdin,不接受file,初始語(yǔ)料庫(kù)為可選項(xiàng)。mkdir in
echo 'abc' > in/seed3. 執(zhí)行測(cè)試在運(yùn)行AFL之前,需要執(zhí)行下面的系統(tǒng)設(shè)置命令,將字符串"core"寫入到文件/proc/sys/kernel/core_pattern中。在Linux系統(tǒng)中,/proc/sys/kernel/core_pattern 文件用于指定當(dāng)程序崩潰時(shí),內(nèi)核轉(zhuǎn)儲(chǔ)文件(core dump)的文件名模式。通過(guò)修改這個(gè)文件,可以控制內(nèi)核生成core文件的行為。通過(guò)執(zhí)行這個(gè)命令,生成的核心轉(zhuǎn)儲(chǔ)文件將以"core"命名,這使得AFL更容易檢測(cè)和處理目標(biāo)程序的崩潰情況,從而更好地進(jìn)行模糊測(cè)試。echo core | tee /proc/sys/kernel/core_pattern在hello中使用gets函數(shù)從stdin中讀取數(shù)據(jù),因此在運(yùn)行AFL時(shí),不需要添加@@。是否使用@@取決于待測(cè)程序接受的輸入來(lái)自file還是stdin。afl-fuzz -i in -o out -- ./hello4. 結(jié)果解讀AFL開(kāi)始運(yùn)行后,將會(huì)看到如下的界面顯示:AFL運(yùn)行界面從這個(gè)界面上可以看到AFL找到了多少crash,但還不能直觀地顯示覆蓋率。pythia是一款A(yù)FL的擴(kuò)展工具,可以查看代碼覆蓋率的情況。AFL在運(yùn)行過(guò)程中,會(huì)不斷地產(chǎn)生輸出。輸出目錄結(jié)構(gòu)如下:out
|-- crashes
| |-- README.txt
| |-- id:000000,sig:06,src:000000,op:havoc,rep:64
| |-- id:000001,sig:06,src:000002+000003,op:splice,rep:128
| |-- id:000002,sig:06,src:000003,op:havoc,rep:32
| |-- id:000003,sig:06,src:000002+000003,op:splice,rep:16
| |-- id:000004,sig:06,src:000004,op:havoc,rep:32
| |-- id:000005,sig:11,src:000003+000002,op:splice,rep:64
| `-- id:000006,sig:06,src:000004+000005,op:splice,rep:2
|-- fuzz_bitmap
|-- fuzzer_stats
|-- hangs
|-- plot_data
`-- queue
|-- id:000000,orig:seed
|-- id:000001,src:000000,op:havoc,rep:16,+cov
|-- id:000002,src:000000+000001,op:splice,rep:4,+cov
|-- id:000003,src:000001,op:arith8,pos:1,val:-5,+cov
|-- id:000004,src:000001,op:arith8,pos:1,val:-9,+cov
`-- id:000005,src:000002+000003,op:splice,rep:4,+cov
3 directories, 17 filesqueue/ - 存放AFL生成的觸發(fā)新代碼路徑的測(cè)試樣本 crashes/ - 存放能觸發(fā)待測(cè)程序崩潰的測(cè)試樣本 hangs/ - 存發(fā)導(dǎo)致待測(cè)程序超時(shí)的測(cè)試樣本 fuzzer_stats - 文本文件,包含了fuzzer的實(shí)時(shí)統(tǒng)計(jì)信息,如執(zhí)行速度、路徑覆蓋等度量指標(biāo)。這個(gè)文件不斷更新以反映當(dāng)前的fuzzing狀態(tài)。 plot_data - 文本文件,包含了AFL執(zhí)行過(guò)程中的統(tǒng)計(jì)數(shù)據(jù)。使用AFL的afl-plot工具處理plot_data文件,可以生成fuzz過(guò)程的可視化圖像。 fuzz_bitmap - 這是用來(lái)記錄路徑覆蓋率的位圖(coverage bitmap),非人類可讀。AFL使用這個(gè)位圖來(lái)跟蹤程序在處理不同輸入時(shí)執(zhí)行的不同分支,用來(lái)幫助AFL識(shí)別新的、唯一的代碼路徑,以便后續(xù)生成更具有探索性的測(cè)試樣本。 四、AFL的QEMU模式前面的例子中,AFL在對(duì)待測(cè)程序的源碼進(jìn)行編譯時(shí)插樁。實(shí)際中,我們不一定能拿到待測(cè)源碼,我們要測(cè)的可能是一個(gè)已經(jīng)編譯好的二進(jìn)制文件。這種情況下Libfuzzer就無(wú)能為力了,但AFL還能用,這依賴于AFL的QEMU模式。AFL的QEMU模式,也稱為AFL-QEMU,允許你在二進(jìn)制模糊測(cè)試中使用AFL,即使源代碼不可用。這在對(duì)閉源應(yīng)用進(jìn)行模糊測(cè)試時(shí)非常有用。這種模式使用QEMU的用戶模式仿真,來(lái)運(yùn)行并分析非原生的二進(jìn)制文件。以下是安裝AFL的QEMU模式和使用步驟的指南:1. 編譯QEMU支持在AFL主目錄下有一個(gè)專門的QEMU模式目錄。進(jìn)入該目錄并編譯QEMU模式,過(guò)程中可能缺少依賴項(xiàng),根據(jù)提示進(jìn)行安裝即可:cd qemu_mode
./build_qemu_support.sh2. AFL-QEMU使用步驟用法很簡(jiǎn)單,在AFL運(yùn)行命令中添加-Q參數(shù)即可:afl-fuzz -i input -o output -Q -- /path/to/binary @@五、AFL的升級(jí)版——AFL++AFL++可以看作是原始AFL的"增強(qiáng)版",對(duì)AFL的調(diào)度策略和變異算法進(jìn)行了很多改進(jìn),同時(shí)還引入了很多新特性,如CMPLOG和持久化這樣的特性。1. CMPLOGCMPLOG是AFL++引入的一個(gè)新功能,類似于Libfuzzer中的trace-cmp,它可以極大地提高代碼覆蓋率。CMPLOG的主要作用是對(duì)程序中的所有比較操作進(jìn)行記錄,包括等于、不等于、小于等邏輯比較。當(dāng)fuzzer執(zhí)行時(shí),CMPLOG能夠捕獲比較操作的參數(shù),并將對(duì)應(yīng)的值添加到fuzzer的輸入測(cè)試用例中。這個(gè)過(guò)程實(shí)際上幫助fuzzer更好地理解代碼中期待的輸入,特別是那些用于邏輯分支的字面值和魔法數(shù)字。這種理解能夠?qū)蚋钊氲穆窂礁采w,進(jìn)而揭露隱藏更深的潛在缺陷。2. 持久化模式AFL的持久化(persistent)模式允許目標(biāo)程序在單個(gè)進(jìn)程周期內(nèi)重復(fù)執(zhí)行多次模糊測(cè)試用例。這對(duì)性能產(chǎn)生了顯著的提升,因?yàn)樗鼫p少了程序啟動(dòng)和終止的開(kāi)銷,特別是當(dāng)測(cè)試的目標(biāo)程序需要很大的初始化成本時(shí)。在AFL++中,持久化模式的執(zhí)行更為高效,它允許模糊器在目標(biāo)程序中一次性執(zhí)行多個(gè)測(cè)試用例,而非每次執(zhí)行一個(gè)用例都重啟目標(biāo)程序。有了持久化模式,AFL++能夠在相同的時(shí)間內(nèi)執(zhí)行更多的測(cè)試迭代,從而提高漏洞檢測(cè)的速度。六、小結(jié)AFL是一款強(qiáng)大的模糊測(cè)試工具,實(shí)踐中AFL++的應(yīng)用非常廣泛。相比Libfuzzer,AFL++不局限于源碼,并且支持多種cpu架構(gòu),還有豐富的插件生態(tài)可以使用。但模糊測(cè)試本身存在覆蓋率瓶頸的問(wèn)題,難以探索復(fù)雜的程序路徑,這時(shí)候可以結(jié)合其他的技術(shù),如符號(hào)執(zhí)行來(lái)突破。發(fā)布于 2024-01-31 13:01?IP 屬地中國(guó)臺(tái)灣fuzzing?贊同??添加評(píng)論?分享?喜歡?收藏?申請(qǐng)轉(zhuǎn)載?文章被以下專欄收錄安全領(lǐng)域入個(gè)門吧工具、原理
AFL | 一篇圖文帶你看懂澳式足球_比賽
新聞
體育
汽車
房產(chǎn)
旅游
教育
時(shí)尚
科技
財(cái)經(jīng)
娛樂(lè)
更多
母嬰
健康
歷史
軍事
美食
文化
星座
專題
游戲
搞笑
動(dòng)漫
寵物
無(wú)障礙
關(guān)懷版
AFL | 一篇圖文帶你看懂澳式足球
2018-09-28 14:28
來(lái)源:
愛(ài)德留學(xué)
原標(biāo)題:AFL | 一篇圖文帶你看懂澳式足球
本周末澳式足球聯(lián)賽總決賽
墨爾本的小伙伴們可以多放一天假
是不是很開(kāi)心!!
可是,你真的了解澳式足球嗎?
小編記得剛到澳洲的時(shí)候,Homestay的房東問(wèn)我喜歡什么體育運(yùn)動(dòng),我說(shuō)“football”;于是他就每周都拉著我看橄欖球比賽!
我是滿臉寫著懵!懵!懵!
他說(shuō):“是你說(shuō)喜歡足球的???!”
展開(kāi)全文
相信類似的體會(huì),很多華人朋友都有。
想要融入當(dāng)?shù)厝说娜ψ?/p>
聊聊體育是個(gè)很好的切入點(diǎn)!
但澳洲的主流運(yùn)動(dòng)好像
離我們熟悉的領(lǐng)域比較遠(yuǎn)
想了解澳式足球
來(lái)來(lái)來(lái),看這里
一篇圖文帶你看懂澳式足球
本次決賽
澳式足球簡(jiǎn)介
澳式橄欖球(Australian Rules football), 又稱為澳式足球(Aussie football), 是一種源自于墨爾本地區(qū)的球類運(yùn)動(dòng)。在風(fēng)行澳式足球的地區(qū),這種運(yùn)動(dòng)就被簡(jiǎn)稱為"footy"。
與其他足球(消歧義)的規(guī)則不同,澳式足球(就澳大利亞足球聯(lián)盟規(guī)則而言),每隊(duì)含替補(bǔ)球員在內(nèi)共有二十二人 ,比賽在板球場(chǎng)或差不多大小的草地球場(chǎng)上進(jìn)行,球場(chǎng)長(zhǎng)度可達(dá)185公尺 (200 碼); 這樣的場(chǎng)地比起其他規(guī)則的足球賽大很多。
主要技術(shù)
腳踢球(kicking)
是澳式足球中最重要的技能,包括落地奔踢、魚雷踢、弧線球和速射等多種不同踢法。落地奔踢是大多數(shù)球員最為常用的踢法。
接球(marking)
在澳式足球中是指完全接住被踢出的球,同時(shí)也是澳式足球最引人注目的一大特點(diǎn)。球員既可以用胸部接球(用身體抱?。┮部梢杂盟麄兊碾p手接球。
手擊球(handball)
是澳式足球中的重要部分,也是擺脫平局或者發(fā)動(dòng)進(jìn)攻的極好手段。手擊球就是單手掌中持球并用另一只緊握的拳頭將球擊出。
擒抱(tackling)
是一項(xiàng)不可缺少的技術(shù)。當(dāng)對(duì)方球員持球時(shí)球員們可以進(jìn)行擒抱。最好的擒抱者關(guān)注對(duì)方球員的髖部,并且放低身體重心,以確保擒抱的正確高度(腰部周圍)。
拍球(bouncing)
在近年來(lái)已經(jīng)成為一種打破場(chǎng)上僵局和創(chuàng)造空間的重要技巧。球員在帶球跑動(dòng)中每15米就必須拍一次球。
比賽規(guī)則
比賽由外場(chǎng)裁判員控制,外場(chǎng)裁判員掌握比賽的進(jìn)行并判定任意球(free kick)。
外場(chǎng)裁判員會(huì)在以下?tīng)顩r發(fā)生時(shí)判罰任意球:
持球過(guò)久(holding the ball)
背后推人(push in the back)
高位身體接觸(high contact)
球完全出界(out of bounds on the full)
得分
6分球 (goal)
若球被踢進(jìn)中間兩個(gè)較高的球門標(biāo)桿之間,此進(jìn)球的分值為6分。球不必完全穿過(guò)球門線,但是進(jìn)球過(guò)程中任何球員都不得觸碰球。
1分球 (behind)
得分的方法有幾種:球觸球門標(biāo)桿;球穿過(guò)較高標(biāo)桿與較低標(biāo)桿之間;在球越線前被另一球員接觸,或者被防守隊(duì)員帶球過(guò)線。此進(jìn)球由主裁判單手揮舞一面旗幟來(lái)示意。
澳式足球聯(lián)賽
澳大利亞澳式足球聯(lián)盟 (Australian Football League,簡(jiǎn)稱AFL) 是最高水平的澳式足球賽事,也是澳大利亞第一體育聯(lián)盟。
聯(lián)賽由三月尾進(jìn)行至八月尾/九月初,然后是四星期的決賽周,并以兩隊(duì)在澳大利亞澳式足球聯(lián)盟總決賽爭(zhēng)奪超級(jí)杯為終結(jié)。
參賽隊(duì)伍
本賽季參賽隊(duì)伍,以及常規(guī)賽排名
澳式足球 VS 澳式橄欖球
廣義上來(lái)講,澳洲人口中的“footy”,其實(shí)同時(shí)指澳式足球(Australian rules football)與聯(lián)盟式橄欖球(Rugby league football)兩種運(yùn)動(dòng)??瓷先ザ际情蠙烨?,規(guī)則其實(shí)不盡相同。
主要的不同點(diǎn),反映在兩個(gè)不同的聯(lián)賽:
全國(guó)橄欖球聯(lián)賽
National Rugby League, NRL
澳式足球聯(lián)盟
Australian Football League,AFL
兩者都是全國(guó)性質(zhì)的聯(lián)賽;AFL是以維州為中心,而NRL是以新州為中心。
兩者的發(fā)展歷程,比賽規(guī)則等等也是大同小異。
上面我們主要介紹了AFL
這里再簡(jiǎn)單梳理一下NRL:
聯(lián)盟式橄欖球在新南威爾士州、昆士蘭州更流行,比賽在長(zhǎng)方形的草地上舉行,兩隊(duì)均派出十三名選手參賽,外加四名替補(bǔ)球員。
比賽時(shí)間分上下半場(chǎng),各四十分鐘。如果八十分鐘內(nèi)兩隊(duì)打平,根據(jù)具體賽制,可能就以平局收?qǐng)?,或者進(jìn)入加時(shí)金球制勝。每隊(duì)各十個(gè)換人名額,換人次數(shù)不限。
聯(lián)盟式橄欖球的得分方式分為兩種:Try(觸地得分)與Goal(踢球得分)。
觸地得分是指攻方球員通過(guò)傳球扯開(kāi)防守線,然后帶球沖到守方得分區(qū)觸地后可一次得4分,之后自動(dòng)得到一次踢球射門的機(jī)會(huì),將球射入“H”型球門橫桿上方后可得2分。
如果防守方在己方半場(chǎng)犯規(guī),而犯規(guī)地點(diǎn)離球門比較近,攻方可以選擇射門,射進(jìn)得1分。
從每年的三月到十月是NRL的比賽日,16支球隊(duì)將在常規(guī)賽進(jìn)行26輪比賽.26輪比賽結(jié)束后排名榜首的球隊(duì)被稱為“小冠軍”,排名前八的球隊(duì)再逐隊(duì)廝殺決出最后兩支球隊(duì)進(jìn)行決賽。
現(xiàn)在你對(duì)OZ Footy有了一定了解了吧
百聞不如一見(jiàn)
真正的了解澳式足球
從欣賞本次AFL總決賽開(kāi)始吧
返回搜狐,查看更多
責(zé)任編輯:
平臺(tái)聲明:該文觀點(diǎn)僅代表作者本人,搜狐號(hào)系信息發(fā)布平臺(tái),搜狐僅提供信息存儲(chǔ)空間服務(wù)。
閱讀 ()
推薦閱讀
從AFL開(kāi)始FUZZ之旅 - 知乎切換模式寫文章登錄/注冊(cè)從AFL開(kāi)始FUZZ之旅合天網(wǎng)安實(shí)驗(yàn)室原創(chuàng):hpw合天智匯原創(chuàng)投稿活動(dòng):重金懸賞 | 合天原創(chuàng)投稿等你來(lái)前言我想介紹一些不一樣的東西-fuzz,也就是大家常說(shuō)的模糊測(cè)試。Fuzz是近幾年來(lái)安全頂會(huì)的熱門,投稿難度也越來(lái)越大。一次成功的fuzz甚至能挖掘出幾十個(gè)CVE。我準(zhǔn)備在該文章中先介紹fuzz相關(guān)的知識(shí),然后以AFL為例演示一個(gè)fuzz例子;不足之處還請(qǐng)各位讀者斧正。什么是Fuzz進(jìn)行軟件漏洞挖掘時(shí),通常有靜態(tài)分析(staticanalysis)、動(dòng)態(tài)分析(dynamicanalysis)、符號(hào)執(zhí)行(symbolicexecution)、模糊測(cè)試(fuzzing)這幾種技術(shù)手段。靜態(tài)分析就是不真正的運(yùn)行目標(biāo)程序,但是通過(guò)對(duì)它進(jìn)行各種語(yǔ)法、語(yǔ)義、數(shù)據(jù)流等的分析,來(lái)進(jìn)行漏洞發(fā)掘。靜態(tài)分析是由靜態(tài)分析軟件完成的;它的速度快,但是誤報(bào)率高。動(dòng)態(tài)分析就是我們通常見(jiàn)到的大佬們用od一步步跟蹤程序運(yùn)行進(jìn)行的分析。它的準(zhǔn)確率很高,但是需要調(diào)試人員豐富的知識(shí)儲(chǔ)備,而且這種調(diào)試方法很難進(jìn)行大規(guī)模的程序漏洞挖掘。符號(hào)執(zhí)行簡(jiǎn)單來(lái)說(shuō),就是試圖找到什么輸入對(duì)應(yīng)什么樣的運(yùn)行狀態(tài),它要去覆蓋所有的執(zhí)行路徑。因此,當(dāng)被分析的程序比較復(fù)雜,有很多執(zhí)行路徑時(shí),就會(huì)遇到路徑爆炸的問(wèn)題。模糊測(cè)試不需要人過(guò)多的參與,也不像動(dòng)態(tài)分析那樣要求分析人員有豐富的知識(shí)。簡(jiǎn)單解釋,它就是用大量的輸入數(shù)據(jù)自動(dòng)去執(zhí)行程序,從而發(fā)現(xiàn)哪些輸入能夠使程序發(fā)生異常,進(jìn)而分析可能存在的漏洞。當(dāng)前比較成功的fuzzer(執(zhí)行模糊測(cè)試的程序)有AFL、libFuzzer、OSS-Fuzz等。用AFL來(lái)示意一個(gè)典型的Fuzz過(guò)程調(diào)試人員為程序提供一些輸入,即最左側(cè)的testcases,AFL加載后將其放入一個(gè)隊(duì)列中。對(duì)于每一次迭代,AFL首先從隊(duì)列中取出一個(gè)testcase,然后對(duì)它進(jìn)行修剪,去除不必要的數(shù)據(jù)以提高運(yùn)行效率;再然后對(duì)輸入進(jìn)行變異操作,變異的模式很多,可以產(chǎn)生很多新的testcase。對(duì)于這些新產(chǎn)生的輸入,將它們送到目標(biāo)程序運(yùn)行,若能夠產(chǎn)生新的執(zhí)行路徑或者導(dǎo)致程序崩潰,就把它再放到隊(duì)列中。在整個(gè)過(guò)程中,程序崩潰會(huì)被記錄下來(lái),它可能代表一個(gè)潛藏的漏洞。Fuzz的技術(shù)要點(diǎn)那么這一項(xiàng)技術(shù)主要有哪些難點(diǎn),或者說(shuō)影響挖掘效率的點(diǎn)呢?在安全會(huì)議上經(jīng)常能看到對(duì)于這些問(wèn)題的研究,比如2019年USENIX上用粒子群算法來(lái)輔助變異操作符的選擇,AFL的變體AFLGo其實(shí)也是在CSS上發(fā)表的。輸入數(shù)據(jù)因?yàn)橐幂斎霐?shù)據(jù)去自動(dòng)執(zhí)行程序,很明顯數(shù)據(jù)的生成會(huì)極大的影響挖掘效率。1.假如目標(biāo)程序的輸入格式是pdf文件,那么不符合該格式的文件就很難進(jìn)入到目標(biāo)程序內(nèi)部進(jìn)行運(yùn)行測(cè)試。2.即使是符合輸入要求的數(shù)據(jù),也許數(shù)據(jù)A和數(shù)據(jù)B觸發(fā)相同的執(zhí)行路徑,那么讓A和B都運(yùn)行就是在浪費(fèi)資源。3.對(duì)于單獨(dú)的數(shù)據(jù)A,也許其中真正控制執(zhí)行路徑的只是一小部分,那么在其余部分的處理就是在浪費(fèi)資源。對(duì)于第一個(gè)輸入格式的問(wèn)題,generation-basedfuzzer給出了可行的解決方案。簡(jiǎn)單來(lái)說(shuō),它要求一些關(guān)于輸入數(shù)據(jù)格式的先驗(yàn)知識(shí),這樣它就可以更好地根據(jù)用戶輸入數(shù)據(jù)產(chǎn)生新數(shù)據(jù)。對(duì)于第二和第三個(gè)問(wèn)題,AFL中給出了相應(yīng)的解決辦法。Afl-cmin能夠給出輸入數(shù)據(jù)的最小集合,也就是會(huì)把上述的A和B留其一;afl-tmin則能夠?qū)蝹€(gè)輸入文件進(jìn)行壓縮。變異操作用戶給出的數(shù)據(jù)是有限的,但是進(jìn)行fuzz測(cè)試需要大量的數(shù)據(jù),因此fuzzer會(huì)根據(jù)用戶給出的數(shù)據(jù)產(chǎn)生新的數(shù)據(jù),這一過(guò)程即所謂的變異操作。那么變異過(guò)程中定義哪些變異操作符(即哪些改變?cè)斎霐?shù)據(jù)的操作)?在一次變異時(shí)面對(duì)多個(gè)變異操作符該選擇哪個(gè)?選用哪些輸入數(shù)據(jù)進(jìn)行變異?提高覆蓋率Fuzz的本質(zhì)就是用輸入去檢測(cè)當(dāng)前輸入對(duì)應(yīng)的執(zhí)行路徑會(huì)不會(huì)產(chǎn)生可能的漏洞。因此,如果覆蓋更多的路徑,就意味著可能檢測(cè)出更多的漏洞。提高覆蓋率更像是一個(gè)根本性問(wèn)題,前兩個(gè)問(wèn)題的解決其實(shí)也是在提高覆蓋率。AFL實(shí)戰(zhàn)安裝要點(diǎn)AFL其實(shí)有很多模式,除了標(biāo)準(zhǔn)模式,還有l(wèi)lvm模式和qemu模式。得益于clang,llvm模式下fuzz速度更快;qemu模式則可以對(duì)二進(jìn)制程序進(jìn)行fuzz。有很多人在安裝時(shí)并沒(méi)有同時(shí)編譯安裝llvm模式,雖然可以稍后單獨(dú)編譯,但是AFL官方文檔中建議如果想要所有系統(tǒng)用戶都可以使用llvm模式,就在編譯安裝AFL時(shí)同時(shí)安裝llvm模式。安裝時(shí)還有一個(gè)坑:很多人喜歡在docker中使用它,但是別忘了在開(kāi)啟container時(shí)加上—privileged選項(xiàng),否則在下述某一命令執(zhí)行時(shí)會(huì)失敗。安裝過(guò)程我就不贅述了,但是這里推薦一個(gè)安裝過(guò)程。如果docker不加—privileged這一條命令會(huì)失?。哼@里是在安裝AFL時(shí)同時(shí)編譯安裝了llvm模式:編譯安裝目標(biāo)程序我們選取w3m作為這次的目標(biāo)程序,在下載源碼后,為了AFL能夠順利進(jìn)行fuzz,我們不能直接用gcc進(jìn)行編譯,而是要用afl提供的afl-gcc進(jìn)行。Afl-gcc干了什么呢?其實(shí)我們從源碼得到二進(jìn)制程序,要經(jīng)過(guò)從源代碼到匯編代碼,從匯編代碼到機(jī)器碼的過(guò)程。Gcc(特指gcc編譯器)能夠把源代碼變成匯編代碼,而as(也是GNU編譯器套件一部分)則將匯編碼變成機(jī)器碼。Afl-gcc是gcc編譯器的一個(gè)封裝,它一方面調(diào)用gcc編譯器進(jìn)行編譯,另一方面指定afl-as而非as進(jìn)行匯編。Afl-as也是as的一個(gè)封裝,它一方面分析匯編代碼,進(jìn)行插樁操作,另一方面調(diào)用as將插樁后的匯編代碼變成機(jī)器碼??赡苡钟腥艘獑?wèn)了,什么是插樁?簡(jiǎn)單來(lái)說(shuō),它就是在目標(biāo)程序的代碼中插入一些額外的代碼,來(lái)通知fuzzer目標(biāo)程序的運(yùn)行情況。簡(jiǎn)單了解原理后,來(lái)對(duì)w3m進(jìn)行編譯: cd ./w3m CC=afl-gcc ./configure make由于我們只進(jìn)行fuzz,不想真正安裝w3m,因此不用進(jìn)行makeinstall操作。收集與處理輸入數(shù)據(jù)為了能夠進(jìn)行fuzz,我們需要提供一些輸入數(shù)據(jù)。W3m是一款命令行瀏覽器,因此我們可以收集一些html文件作為輸入。注意,AFL作者建議輸入文件不要太大,盡量保持在1KB內(nèi)。這里我找了幾個(gè)文件作為示例:就像前面說(shuō)的,我們可以使用afl-cmin和afl-tmin進(jìn)行輸入數(shù)據(jù)的縮減。下圖是使用afl-cmin取最小集合的示例。因?yàn)檩斎胩倭?,它們都可以觸發(fā)不同的路徑,因此并沒(méi)有文件被刪除。下圖是使用afl-tmin對(duì)單個(gè)文件進(jìn)行縮減的例子。為了提高速度,你可以寫一個(gè)腳本多線程對(duì)所有輸入文件進(jìn)行縮減操作,否則這一過(guò)程是很費(fèi)時(shí)的。開(kāi)始運(yùn)行通過(guò)以下指令開(kāi)始對(duì)w3m的fuzz操作:如果你不主動(dòng)停止,這一個(gè)fuzz的過(guò)程是不會(huì)結(jié)束的。在右上角,你可以看到當(dāng)前已經(jīng)發(fā)現(xiàn)了多少個(gè)uniquecrashes。運(yùn)行的反思上述只是一個(gè)簡(jiǎn)單的測(cè)試,那么實(shí)踐中,還有哪些技巧來(lái)優(yōu)化上述的fuzz過(guò)程呢?你可以采用AFL的并行模式來(lái)提高fuzz效率你可以在AFL運(yùn)行一段時(shí)間后,暫停運(yùn)行,進(jìn)入保存隊(duì)列的文件夾對(duì)隊(duì)列中的test cases進(jìn)行縮減,然后再繼續(xù)運(yùn)行;你也可以通過(guò)采用llvm模式來(lái)提高速度。結(jié)語(yǔ)雖然上述fuzz是對(duì)本地程序進(jìn)行的fuzz;其實(shí),借助于豐富的插件,或者編寫簡(jiǎn)單的入口代碼,AFL也可以對(duì)網(wǎng)絡(luò)程序,庫(kù)文件等進(jìn)行fuzz。寫這篇簡(jiǎn)單的文章希望能夠?qū)uzz介紹給大家,使得大家能夠?qū)uzz應(yīng)用到自己的漏洞挖掘中。合天網(wǎng)安實(shí)驗(yàn)室的相關(guān)實(shí)驗(yàn)(Fuzz之AFL),讓你了解AFL的使用方法,通過(guò)AFL模糊測(cè)試一些簡(jiǎn)單的軟件,學(xué)習(xí)fuzz的基本方法和思想。實(shí)驗(yàn):Fuzz之AFL(合天網(wǎng)安實(shí)驗(yàn)室)聲明:筆者初衷用于分享與普及網(wǎng)絡(luò)知識(shí),若讀者因此作出任何危害網(wǎng)絡(luò)安全行為后果自負(fù),與合天智匯及原作者無(wú)關(guān)!發(fā)布于 2019-11-04 14:52網(wǎng)絡(luò)安全信息網(wǎng)絡(luò)安全信息安全?贊同 49??2 條評(píng)論?分享?喜歡?收藏?申請(qǐng)