Time is on my side -...

49
Forging Wireless Timing Signals to Attack the NTP Server Time is on my side Time is on my side 1 Yuwei Zheng @HITB Haoqi Shan @HITB From: Qihoo360 Unicorn Team

Transcript of Time is on my side -...

Page 1: Time is on my side - conference.hitb.orgconference.hitb.org/hitbsecconf2016ams/wp-content/uploads/2015/11/... · 0.5s 0.2s 0.5s … WWVB encoding and ... Time is on my side • About

ForgingWirelessTimingSignalstoAttacktheNTPServer

Timeisonmyside

Timeisonmyside1

Yuwei Zheng @HITBHaoqi Shan @HITBFrom: Qihoo360 Unicorn Team

Page 2: Time is on my side - conference.hitb.orgconference.hitb.org/hitbsecconf2016ams/wp-content/uploads/2015/11/... · 0.5s 0.2s 0.5s … WWVB encoding and ... Time is on my side • About

Maincontents

Timeisonmyside

• AbouttheNTPserver• TheNTPstratummode• Thereferenceclock• Forge radio clock signals• Forge GPS clock signals• AttackNTPserver

2

Page 3: Time is on my side - conference.hitb.orgconference.hitb.org/hitbsecconf2016ams/wp-content/uploads/2015/11/... · 0.5s 0.2s 0.5s … WWVB encoding and ... Time is on my side • About

AboutNTPserver

Timeisonmyside

• Aserverforcomputertosynchronizetime.

3

Page 4: Time is on my side - conference.hitb.orgconference.hitb.org/hitbsecconf2016ams/wp-content/uploads/2015/11/... · 0.5s 0.2s 0.5s … WWVB encoding and ... Time is on my side • About

AboutNTPserver

Timeisonmyside

• CriticalIndustriesthatuseNTPservers

4

Page 5: Time is on my side - conference.hitb.orgconference.hitb.org/hitbsecconf2016ams/wp-content/uploads/2015/11/... · 0.5s 0.2s 0.5s … WWVB encoding and ... Time is on my side • About

TheNTPstratummode

Timeisonmyside

• Stratum0Referenceclocks• Stratum1Primarytimeservers• Stratum2• Stratum3…• Stratum16

5

Page 6: Time is on my side - conference.hitb.orgconference.hitb.org/hitbsecconf2016ams/wp-content/uploads/2015/11/... · 0.5s 0.2s 0.5s … WWVB encoding and ... Time is on my side • About

AbouttheNTPserver

Timeisonmyside

• NTPserversaredeployedwithopensourceNTPv4

6

Page 7: Time is on my side - conference.hitb.orgconference.hitb.org/hitbsecconf2016ams/wp-content/uploads/2015/11/... · 0.5s 0.2s 0.5s … WWVB encoding and ... Time is on my side • About

Thereferenceclock

Timeisonmyside

• ReferenceClockDriversintheopensourceNTPv4Type2Deprecated: wasTrak 8820GPSReceiverType3PSTI/Traconex 1020WWV/WWVHReceiver(WWV_PST)Type4Spectracom WWVB/GPSReceivers(WWVB_SPEC)Type5TrueTimeGPS/GOES/OMEGA Receivers(TRUETIME)Type6IRIGAudioDecoder(IRIG_AUDIO)Type7RadioCHUAudioDemodulator/Decoder(CHU)…Type39hopf GPS/DCF776039forPCI-Bus(HOPF_P)Type40JJYReceivers(JJY)Type41TrueTime 560IRIG-BDecoderType42ZyferGPStarplus ReceiverType43RIPENCCinterfaceforTrimblePalisadeType44NeoClock4X- DCF77/TDFseriallineType45Spectracom TSYNCPCIType46GPSDNGclientprotocol

7

Page 8: Time is on my side - conference.hitb.orgconference.hitb.org/hitbsecconf2016ams/wp-content/uploads/2015/11/... · 0.5s 0.2s 0.5s … WWVB encoding and ... Time is on my side • About

Thereferenceclock

Timeisonmyside

Whydoesthestratum-1NTPserveruseradioclockandGPS?• Atomicclock,accurate,butexpensive• GPS• radioclock

8

Page 9: Time is on my side - conference.hitb.orgconference.hitb.org/hitbsecconf2016ams/wp-content/uploads/2015/11/... · 0.5s 0.2s 0.5s … WWVB encoding and ... Time is on my side • About

Thereferenceclock

Timeisonmyside

• ReceivercardssupportedbyNTPV4

9

Page 10: Time is on my side - conference.hitb.orgconference.hitb.org/hitbsecconf2016ams/wp-content/uploads/2015/11/... · 0.5s 0.2s 0.5s … WWVB encoding and ... Time is on my side • About

Thereferenceclock

Timeisonmyside

• Stratum1NTPserverproductforindustrialusing

10

Page 11: Time is on my side - conference.hitb.orgconference.hitb.org/hitbsecconf2016ams/wp-content/uploads/2015/11/... · 0.5s 0.2s 0.5s … WWVB encoding and ... Time is on my side • About

Thereferenceclock

Timeisonmyside

• ItsupportsDCF77,MSF,WWVB,andGPS

11

Page 12: Time is on my side - conference.hitb.orgconference.hitb.org/hitbsecconf2016ams/wp-content/uploads/2015/11/... · 0.5s 0.2s 0.5s … WWVB encoding and ... Time is on my side • About

Forgelongwavetimingsignals

Timeisonmyside

• DIYacircuittotransmitradioclocksignalssupportWWVB,JJY,DCF77,andMSF

12

Page 13: Time is on my side - conference.hitb.orgconference.hitb.org/hitbsecconf2016ams/wp-content/uploads/2015/11/... · 0.5s 0.2s 0.5s … WWVB encoding and ... Time is on my side • About

WWVBencodingandmodulation

Timeisonmyside

• Different pulse width representdifferentdatabit

13

1 2 3 4t(s)

p

reduced

full

0.8s

marker 1 0 1

0.5s 0.5s0.2s

Page 14: Time is on my side - conference.hitb.orgconference.hitb.org/hitbsecconf2016ams/wp-content/uploads/2015/11/... · 0.5s 0.2s 0.5s … WWVB encoding and ... Time is on my side • About

WWVBencodingandmodulation

Timeisonmyside

• 60Khzcarrier

14

Page 15: Time is on my side - conference.hitb.orgconference.hitb.org/hitbsecconf2016ams/wp-content/uploads/2015/11/... · 0.5s 0.2s 0.5s … WWVB encoding and ... Time is on my side • About

WWVBencodingandmodulation

Timeisonmyside

• ASKmodulation

15

Page 16: Time is on my side - conference.hitb.orgconference.hitb.org/hitbsecconf2016ams/wp-content/uploads/2015/11/... · 0.5s 0.2s 0.5s … WWVB encoding and ... Time is on my side • About

WWVBencodingandmodulation

Timeisonmyside

• Theframestructure

16

Page 17: Time is on my side - conference.hitb.orgconference.hitb.org/hitbsecconf2016ams/wp-content/uploads/2015/11/... · 0.5s 0.2s 0.5s … WWVB encoding and ... Time is on my side • About

JJYencodingandmodulation

Timeisonmyside

Similar to the WWVB

17

1 2 3 4t(s)

p

reduced

full

0.8s

marker1 0 1

0.5s 0.5s0.2s

Page 18: Time is on my side - conference.hitb.orgconference.hitb.org/hitbsecconf2016ams/wp-content/uploads/2015/11/... · 0.5s 0.2s 0.5s … WWVB encoding and ... Time is on my side • About

DCF77encodingandmodulation

Timeisonmyside

• SimilartoWWVB,itusesa 77.5hzcarrier

18

Page 19: Time is on my side - conference.hitb.orgconference.hitb.org/hitbsecconf2016ams/wp-content/uploads/2015/11/... · 0.5s 0.2s 0.5s … WWVB encoding and ... Time is on my side • About

Longwavetimingsignaltransmitter

Timeisonmyside

• Usead9850DDSmoduletogeneratethecarrier

19

Page 20: Time is on my side - conference.hitb.orgconference.hitb.org/hitbsecconf2016ams/wp-content/uploads/2015/11/... · 0.5s 0.2s 0.5s … WWVB encoding and ... Time is on my side • About

Longwavetimingsignaltransmitter

Timeisonmyside

• AboutAD9850DDSmodulesupportstooutput0-40Mhzwavesendsallradioclocksignalswithonecircuit

• Usearduino tocontrolad9850Ad9850seriallibraryforarduinohttps://github.com/F4GOJ/AD9850

20

Page 21: Time is on my side - conference.hitb.orgconference.hitb.org/hitbsecconf2016ams/wp-content/uploads/2015/11/... · 0.5s 0.2s 0.5s … WWVB encoding and ... Time is on my side • About

Longwavetimingsignaltransmitter

Timeisonmyside

• AsimpleJJYtransmittervoidsendMark(){//Sendhighfor0.2secDDS.setfreq(freq,phase);delay(200);//Sendlowfor0.8secDDS.down();delay(800);return;

}

21

Page 22: Time is on my side - conference.hitb.orgconference.hitb.org/hitbsecconf2016ams/wp-content/uploads/2015/11/... · 0.5s 0.2s 0.5s … WWVB encoding and ... Time is on my side • About

Longwavetimingsignaltransmitter

Timeisonmyside

• AsimpleJJYtransmittervoidsendBit1(){//Sendhighfor0.5secDDS.setfreq(freq,phase);delay(500);//Sendlowfor0.5secDDS.down();delay(500);return;

}

22

Page 23: Time is on my side - conference.hitb.orgconference.hitb.org/hitbsecconf2016ams/wp-content/uploads/2015/11/... · 0.5s 0.2s 0.5s … WWVB encoding and ... Time is on my side • About

Longwavetimingsignaltransmitter

Timeisonmyside

• AsimpleJJYtransmittervoidsendBitZero(){//Sendhighfor0.8secDDS.setfreq(freq,phase);delay(800);//Sendlowfor0.2secDDS.down();delay(200);return;

}

23

Page 24: Time is on my side - conference.hitb.orgconference.hitb.org/hitbsecconf2016ams/wp-content/uploads/2015/11/... · 0.5s 0.2s 0.5s … WWVB encoding and ... Time is on my side • About

Longwavetimingsignaltransmitter

Timeisonmyside

• GettheantennafromanJJYreceiver

L=1890uH.𝑓 = $

%& '(,for60khzcarrierC=3.6nF

Forthe77.5khzcarrier,C=2.2nF

24

Page 25: Time is on my side - conference.hitb.orgconference.hitb.org/hitbsecconf2016ams/wp-content/uploads/2015/11/... · 0.5s 0.2s 0.5s … WWVB encoding and ... Time is on my side • About

Longwavetimingsignaltransmitter

Timeisonmyside25

• Thewholecircuitoftheuniformtransmitter

Page 26: Time is on my side - conference.hitb.orgconference.hitb.org/hitbsecconf2016ams/wp-content/uploads/2015/11/... · 0.5s 0.2s 0.5s … WWVB encoding and ... Time is on my side • About

Longwavetimingsignaltransmitter

Timeisonmyside26

• LongdistancetransmitterDesignapoweramplifierwithMOSFETIR540.

Page 27: Time is on my side - conference.hitb.orgconference.hitb.org/hitbsecconf2016ams/wp-content/uploads/2015/11/... · 0.5s 0.2s 0.5s … WWVB encoding and ... Time is on my side • About

AttackGPSNTPreceiver

Timeisonmyside

• GPSreceiver• GPStechbriefing• GenerateGPSsignal• Haveatry• Upgradeattackalgorithm

27

Page 28: Time is on my side - conference.hitb.orgconference.hitb.org/hitbsecconf2016ams/wp-content/uploads/2015/11/... · 0.5s 0.2s 0.5s … WWVB encoding and ... Time is on my side • About

GPSreceiver

Timeisonmyside

• MultiplyConnection• PCI• USB• Serialport

28

Page 29: Time is on my side - conference.hitb.orgconference.hitb.org/hitbsecconf2016ams/wp-content/uploads/2015/11/... · 0.5s 0.2s 0.5s … WWVB encoding and ... Time is on my side • About

GPStechbriefing

Timeisonmyside

• Complicatedprinciple• Butdoesn’tmatter,it’sopen-sourced• Defcon23“GPSSpoofing- LinHuang”

29

Page 30: Time is on my side - conference.hitb.orgconference.hitb.org/hitbsecconf2016ams/wp-content/uploads/2015/11/... · 0.5s 0.2s 0.5s … WWVB encoding and ... Time is on my side • About

GPStechbriefing

Timeisonmyside30

Subframe 1 Subframe 2 Subframe 3 Subframe 4 Subframe 5

Time information Ephemeris

Page 31: Time is on my side - conference.hitb.orgconference.hitb.org/hitbsecconf2016ams/wp-content/uploads/2015/11/... · 0.5s 0.2s 0.5s … WWVB encoding and ... Time is on my side • About

GenerateGPSsignal

Timeisonmyside31

Page 32: Time is on my side - conference.hitb.orgconference.hitb.org/hitbsecconf2016ams/wp-content/uploads/2015/11/... · 0.5s 0.2s 0.5s … WWVB encoding and ... Time is on my side • About

Haveatry

Timeisonmyside32

Page 33: Time is on my side - conference.hitb.orgconference.hitb.org/hitbsecconf2016ams/wp-content/uploads/2015/11/... · 0.5s 0.2s 0.5s … WWVB encoding and ... Time is on my side • About

Panic

Timeisonmyside33

Page 34: Time is on my side - conference.hitb.orgconference.hitb.org/hitbsecconf2016ams/wp-content/uploads/2015/11/... · 0.5s 0.2s 0.5s … WWVB encoding and ... Time is on my side • About

Update attack algorithm

Timeisonmyside34

• Find GPSTime• Replace it• Re-ParityCheck

Page 35: Time is on my side - conference.hitb.orgconference.hitb.org/hitbsecconf2016ams/wp-content/uploads/2015/11/... · 0.5s 0.2s 0.5s … WWVB encoding and ... Time is on my side • About

Setup an NTP server

HackingFemtocell

• Setup an NTP server using JJY as clocksource

35

server127.127.40.0mode1preferfudge 127.127.40.0flag1stratum0

Page 36: Time is on my side - conference.hitb.orgconference.hitb.org/hitbsecconf2016ams/wp-content/uploads/2015/11/... · 0.5s 0.2s 0.5s … WWVB encoding and ... Time is on my side • About

Setup anNTPserver

Timeisonmyside

• ThisNTPserverwithJJYreferenceclock

36

Page 37: Time is on my side - conference.hitb.orgconference.hitb.org/hitbsecconf2016ams/wp-content/uploads/2015/11/... · 0.5s 0.2s 0.5s … WWVB encoding and ... Time is on my side • About

Setup an NTP server(JJY)

HackingFemtocell37

Page 38: Time is on my side - conference.hitb.orgconference.hitb.org/hitbsecconf2016ams/wp-content/uploads/2015/11/... · 0.5s 0.2s 0.5s … WWVB encoding and ... Time is on my side • About

AttacktheNTPserver

Timeisonmyside

• Canweinjectanytime?Thetimeoffsetmustbelessthan4hours.

• InjectatimethatisonehourslowthanrealtimeServercrashed!!!

38

Page 39: Time is on my side - conference.hitb.orgconference.hitb.org/hitbsecconf2016ams/wp-content/uploads/2015/11/... · 0.5s 0.2s 0.5s … WWVB encoding and ... Time is on my side • About

AttacktheNTPserver

Timeisonmyside

• Canweinjectanytime?Ifthetimeoffsetismorethan1000s,theserverwillshutdown.

39

Page 40: Time is on my side - conference.hitb.orgconference.hitb.org/hitbsecconf2016ams/wp-content/uploads/2015/11/... · 0.5s 0.2s 0.5s … WWVB encoding and ... Time is on my side • About

AttacktheNTPserver

Timeisonmyside

• Canweinjectanytime?theoffset>1000s,requiremanuallyadjust

40

Page 41: Time is on my side - conference.hitb.orgconference.hitb.org/hitbsecconf2016ams/wp-content/uploads/2015/11/... · 0.5s 0.2s 0.5s … WWVB encoding and ... Time is on my side • About

Root Dispersion

HackingFemtocell41

RFC5905

Page 42: Time is on my side - conference.hitb.orgconference.hitb.org/hitbsecconf2016ams/wp-content/uploads/2015/11/... · 0.5s 0.2s 0.5s … WWVB encoding and ... Time is on my side • About

Attack Demo

Timeisonmyside42

Page 43: Time is on my side - conference.hitb.orgconference.hitb.org/hitbsecconf2016ams/wp-content/uploads/2015/11/... · 0.5s 0.2s 0.5s … WWVB encoding and ... Time is on my side • About

Real Attack?

Time is on my side43

Page 44: Time is on my side - conference.hitb.orgconference.hitb.org/hitbsecconf2016ams/wp-content/uploads/2015/11/... · 0.5s 0.2s 0.5s … WWVB encoding and ... Time is on my side • About

Real Attack?

Time is on my side44

Page 45: Time is on my side - conference.hitb.orgconference.hitb.org/hitbsecconf2016ams/wp-content/uploads/2015/11/... · 0.5s 0.2s 0.5s … WWVB encoding and ... Time is on my side • About

Real Attack?

Time is on my side45

Page 46: Time is on my side - conference.hitb.orgconference.hitb.org/hitbsecconf2016ams/wp-content/uploads/2015/11/... · 0.5s 0.2s 0.5s … WWVB encoding and ... Time is on my side • About

Real Attack?

Time is on my side46

Page 47: Time is on my side - conference.hitb.orgconference.hitb.org/hitbsecconf2016ams/wp-content/uploads/2015/11/... · 0.5s 0.2s 0.5s … WWVB encoding and ... Time is on my side • About

Real Attack?

Time is on my side

• Sensitive & expensive

47

Page 48: Time is on my side - conference.hitb.orgconference.hitb.org/hitbsecconf2016ams/wp-content/uploads/2015/11/... · 0.5s 0.2s 0.5s … WWVB encoding and ... Time is on my side • About

References

Timeisonmyside

•“GPS Spoofing – Huang Lin”• https://www.eecis.udel.edu/~mills/ntp/html/refclock.html• http://www.sundgren.se/1-recreation/2-electronics/dcf77_simulator.htm

48

Page 49: Time is on my side - conference.hitb.orgconference.hitb.org/hitbsecconf2016ams/wp-content/uploads/2015/11/... · 0.5s 0.2s 0.5s … WWVB encoding and ... Time is on my side • About

Thanks

HackingFemtocell

• Any question?• Feel free to contact us!

49