Wednesday, March 21, 2018

ifconfig output on MacOs High Sierra

In a typical Mac OS X, type ifconfig in command line will give a long list of interfaces.

network>ifconfig
lo0: flags=8049<UP,LOOPBACK,RUNNING,MULTICAST> mtu 16384
options=1203<RXCSUM,TXCSUM,TXSTATUS,SW_TIMESTAMP>
inet 127.0.0.1 netmask 0xff000000 
inet6 ::1 prefixlen 128 
inet6 xxx prefixlen 64 scopeid 0x1 
nd6 options=201<PERFORMNUD,DAD>
gif0: flags=8010<POINTOPOINT,MULTICAST> mtu 1280
stf0: flags=0<> mtu 1280
EHC29: flags=0<> mtu 0
EHC26: flags=0<> mtu 0
XHC20: flags=0<> mtu 0
en0: flags=8863<UP,BROADCAST,SMART,RUNNING,SIMPLEX,MULTICAST> mtu 1500
options=10b<RXCSUM,TXCSUM,VLAN_HWTAGGING,AV>
ether xxx 
nd6 options=201<PERFORMNUD,DAD>
media: autoselect (none)
status: inactive
en1: flags=8863<UP,BROADCAST,SMART,RUNNING,SIMPLEX,MULTICAST> mtu 1500
ether xxx 
inet6 xxx prefixlen 64 secured scopeid 0x8 
inet xxx netmask 0xffffff00 broadcast 192.168.2.255
nd6 options=201<PERFORMNUD,DAD>
media: autoselect
status: active
en2: flags=8963<UP,BROADCAST,SMART,RUNNING,PROMISC,SIMPLEX,MULTICAST> mtu 1500
options=60<TSO4,TSO6>
ether xxx 
media: autoselect <full-duplex>
status: inactive
fw0: flags=8863<UP,BROADCAST,SMART,RUNNING,SIMPLEX,MULTICAST> mtu 4078
lladdr xxx 
nd6 options=201<PERFORMNUD,DAD>
media: autoselect <full-duplex>
status: inactive
p2p0: flags=8843<UP,BROADCAST,RUNNING,SIMPLEX,MULTICAST> mtu 2304
ether xxx 
media: autoselect
status: inactive
awdl0: flags=8943<UP,BROADCAST,RUNNING,PROMISC,SIMPLEX,MULTICAST> mtu 1484
ether xxx 
inet6 xxx%awdl0 prefixlen 64 scopeid 0xc 
nd6 options=201<PERFORMNUD,DAD>
media: autoselect
status: active
bridge0: flags=8863<UP,BROADCAST,SMART,RUNNING,SIMPLEX,MULTICAST> mtu 1500
options=63<RXCSUM,TXCSUM,TSO4,TSO6>
ether xxx 
Configuration:
id 0:0:0:0:0:0 priority 0 hellotime 0 fwddelay 0
maxage 0 holdcnt 0 proto stp maxaddr 100 timeout 1200
root id 0:0:0:0:0:0 priority 0 ifcost 0 port 0
ipfilter disabled flags 0x2
member: en2 flags=3<LEARNING,DISCOVER>
        ifmaxaddr 0 port 9 priority 0 path cost 0
nd6 options=201<PERFORMNUD,DAD>
media: <unknown type>
status: inactive
utun0: flags=8051<UP,POINTOPOINT,RUNNING,MULTICAST> mtu 2000
inet6 xxx%utun0 prefixlen 64 scopeid 0xe 
nd6 options=201<PERFORMNUD,DAD>
network>


The following are the explanations about these interfaces:


lo0 is the loopback device, which is used for entirely internal communication such as between two applications running on localhost.

gif0 The gif interface is a generic tunnelling device for IPv4 and IPv6. It can tunnel IPv[46] traffic over IPv[46]. Therefore, there can be four possible configurations. The behavior of gif is mainly based on RFC2893 IPv6-over-IPv4 configured tunnel. It is the mac os X default interface, not a security concern.

6to4 interfaces
6to4 interfaces

stf0 is SixToFour interface. 6to4 is an Internet transition mechanism for migrating from Internet Protocol version 4 (IPv4) to version 6 (IPv6), a system that allows IPv6 packets to be transmitted over an IPv4 network (generally the IPv4 Internet) without the need to configure explicit tunnels. Special relay servers are also in place that allow 6to4 networks to communicate with native IPv6 networks. It is a default interface, not a security concern.

EHC29
EHC26
XHC20
With macOS High Sierra you can use Wireshark to capture USB traffic.  The interface needs to be manually brought up/down to enable/disable packet capture for the specific controller via ifconfig. The capture interfaces are named based on the underlying controller type followed by the bus number:

$ ifconfig
EHC26: flags=0<> mtu 0
XHC20: flags=0<> mtu 0
EHC29: flags=0<> mtu 0

$ ioreg -w0 -rc AppleUSBHostController
+-o XHC1@1400
+-o EHC2@1a00
+-o EHC1@1d00

The format above is @ where the most significant byte of the location is the bus number.  For example, if the device your interested in is connected to the XHCI controller XHC1@1400 then you would enable packet capture via "sudo ifconfig XHC20 up” and disable via “sudo ifconfig XHC20
down”.  Once the interface is up then Wireshark will be able to capture/decode/filter USB traffic for that controller.
These interfaces are MacOs High Sierra default, not security concern.

en0

en1
en2
physical network interfaces. Typically, one of them is the Ethernet interface, one of them is the Airport wifi interface, one of them is the bluetooth interface.

Firewire port
Firewire port

fw0 is networking over firewire. You can connect a Firewire cable between two Macs, and OS X can use that cable as a network connection.

Mac thunderbolt port
Mac thunderbolt port

bridge0 is thunderbolt bridge. You can connect two Thunderbolt-equipped Mac computers using a Thunderbolt cable, then use internet protocol to communicate between the computers.

PPP (PPPSerial)
PPP (PPPSerial)

p2p0 peer to peer serial connection interfaces. If your MacOs have been connected to arduino through USB port, you will have this entry.

awdl0 AWDL (Apple Wireless Direct Link) is a low latency/high speed WiFi peer-to peer-connection Apple uses for everywhere you’d expect: AirDrop, GameKit (which also uses Bluetooth), AirPlay, and perhaps elsewhere. It works using its own dedicated network interface, typically “awdl0". By having multiple interfaces, Apple is able to have your standard WiFi connection on en*, while still broadcasting, browsing, and resolving peer to peer connections on awdl0.




oracle VirtualBox
oracle VirtualBox

utun0 it is the tunnel interface. If you have VirtualBox installed, guest operation system in virtualBox will use this interface to communicate with host operation system. TUN (namely network TUNnel) simulates a network layer device and it operates with layer 3 packets like IP packets. TUN is used with routing. Packets sent by an operating system via a TUN device are delivered to a user-space program which attaches itself to the device. A user-space program may also pass packets into a TUN device. In this case the TUN device delivers (or "injects") these packets to the operating-system network stack thus emulating their reception from an external source.

vment* - is used by VMWare Fusion to provide networking to your virtual machines, and there's likely to be one per VM you have set up.

ports and protocols on Mac OS X

mac os x use Darwin unix at the core, which is heavily influenced by BSD. The following is the ports.

network>cat /etc/protocols
#
# Internet protocols
#
# $FreeBSD$
# from: @(#)protocols 5.1 (Berkeley) 4/17/89
#
# See also http://www.iana.org/assignments/protocol-numbers
#
ip 0 IP # internet protocol, pseudo protocol number
#hopopt 0 HOPOPT # hop-by-hop options for ipv6
icmp 1 ICMP # internet control message protocol
igmp 2 IGMP # internet group management protocol
ggp 3 GGP # gateway-gateway protocol
ipencap 4 IP-ENCAP # IP encapsulated in IP (officially ``IP'')
st2 5 ST2 # ST2 datagram mode (RFC 1819) (officially ``ST'')
tcp 6 TCP # transmission control protocol
cbt 7 CBT # CBT, Tony Ballardie <A.Ballardie@cs.ucl.ac.uk>
egp 8 EGP # exterior gateway protocol
igp 9 IGP # any private interior gateway (Cisco: for IGRP)
bbn-rcc 10 BBN-RCC-MON # BBN RCC Monitoring
nvp 11 NVP-II # Network Voice Protocol
pup 12 PUP # PARC universal packet protocol
argus 13 ARGUS # ARGUS
emcon 14 EMCON # EMCON
xnet 15 XNET # Cross Net Debugger
chaos 16 CHAOS # Chaos
udp 17 UDP # user datagram protocol
mux 18 MUX # Multiplexing protocol
dcn 19 DCN-MEAS # DCN Measurement Subsystems
hmp 20 HMP # host monitoring protocol
prm 21 PRM # packet radio measurement protocol
xns-idp 22 XNS-IDP # Xerox NS IDP
trunk-1 23 TRUNK-1 # Trunk-1
trunk-2 24 TRUNK-2 # Trunk-2
leaf-1 25 LEAF-1 # Leaf-1
leaf-2 26 LEAF-2 # Leaf-2
rdp 27 RDP # "reliable datagram" protocol
irtp 28 IRTP # Internet Reliable Transaction Protocol
iso-tp4 29 ISO-TP4 # ISO Transport Protocol Class 4
netblt 30 NETBLT # Bulk Data Transfer Protocol
mfe-nsp 31 MFE-NSP # MFE Network Services Protocol
merit-inp 32 MERIT-INP # MERIT Internodal Protocol
dccp 33 DCCP # Datagram Congestion Control Protocol
3pc 34 3PC # Third Party Connect Protocol
idpr 35 IDPR # Inter-Domain Policy Routing Protocol
xtp 36 XTP # Xpress Tranfer Protocol
ddp 37 DDP # Datagram Delivery Protocol
idpr-cmtp 38 IDPR-CMTP # IDPR Control Message Transport Proto
tp++ 39 TP++ # TP++ Transport Protocol
il 40 IL # IL Transport Protocol
ipv6 41 IPV6 # ipv6
sdrp 42 SDRP # Source Demand Routing Protocol
ipv6-route 43 IPV6-ROUTE # routing header for ipv6
ipv6-frag 44 IPV6-FRAG # fragment header for ipv6
idrp 45 IDRP # Inter-Domain Routing Protocol
rsvp 46 RSVP # Resource ReSerVation Protocol
gre 47 GRE # Generic Routing Encapsulation
dsr 48 DSR # Dynamic Source Routing Protocol
bna 49 BNA # BNA
esp 50 ESP # encapsulating security payload
ah 51 AH # authentication header
i-nlsp 52 I-NLSP # Integrated Net Layer Security TUBA
swipe 53 SWIPE # IP with Encryption
narp 54 NARP # NBMA Address Resolution Protocol
mobile 55 MOBILE # IP Mobility
tlsp 56 TLSP # Transport Layer Security Protocol
skip 57 SKIP # SKIP
ipv6-icmp 58 IPV6-ICMP icmp6 # ICMP for IPv6
ipv6-nonxt 59 IPV6-NONXT # no next header for ipv6
ipv6-opts 60 IPV6-OPTS # destination options for ipv6
# 61 # any host internal protocol
cftp 62 CFTP # CFTP
# 63 # any local network
sat-expak 64 SAT-EXPAK # SATNET and Backroom EXPAK
kryptolan 65 KRYPTOLAN # Kryptolan
rvd 66 RVD # MIT Remote Virtual Disk Protocol
ippc 67 IPPC # Internet Pluribus Packet Core
# 68 # any distributed filesystem
sat-mon 69 SAT-MON # SATNET Monitoring
visa 70 VISA # VISA Protocol
ipcv 71 IPCV # Internet Packet Core Utility
cpnx 72 CPNX # Computer Protocol Network Executive
cphb 73 CPHB # Computer Protocol Heart Beat
wsn 74 WSN # Wang Span Network
pvp 75 PVP # Packet Video Protocol
br-sat-mon 76 BR-SAT-MON # Backroom SATNET Monitoring
sun-nd 77 SUN-ND # SUN ND PROTOCOL-Temporary
wb-mon 78 WB-MON # WIDEBAND Monitoring
wb-expak 79 WB-EXPAK # WIDEBAND EXPAK
iso-ip 80 ISO-IP # ISO Internet Protocol
vmtp 81 VMTP # Versatile Message Transport
secure-vmtp 82 SECURE-VMTP # SECURE-VMTP
vines 83 VINES # VINES
ttp 84 TTP # TTP
#iptm 84 IPTM # Protocol Internet Protocol Traffic
nsfnet-igp 85 NSFNET-IGP # NSFNET-IGP
dgp 86 DGP # Dissimilar Gateway Protocol
tcf 87 TCF # TCF
eigrp 88 EIGRP # Enhanced Interior Routing Protocol (Cisco)
ospf 89 OSPFIGP # Open Shortest Path First IGP
sprite-rpc 90 Sprite-RPC # Sprite RPC Protocol
larp 91 LARP # Locus Address Resolution Protocol
mtp 92 MTP # Multicast Transport Protocol
ax.25 93 AX.25 # AX.25 Frames
ipip 94 IPIP # Yet Another IP encapsulation
micp 95 MICP # Mobile Internetworking Control Pro.
scc-sp 96 SCC-SP # Semaphore Communications Sec. Pro.
etherip 97 ETHERIP # Ethernet-within-IP Encapsulation
encap 98 ENCAP # Yet Another IP encapsulation
# 99 # any private encryption scheme
gmtp 100 GMTP # GMTP
ifmp 101 IFMP # Ipsilon Flow Management Protocol
pnni 102 PNNI # PNNI over IP
pim 103 PIM # Protocol Independent Multicast
aris 104 ARIS # ARIS
scps 105 SCPS # SCPS
qnx 106 QNX # QNX
a/n 107 A/N # Active Networks
ipcomp 108 IPComp # IP Payload Compression Protocol
snp 109 SNP # Sitara Networks Protocol
compaq-peer 110 Compaq-Peer # Compaq Peer Protocol
ipx-in-ip 111 IPX-in-IP # IPX in IP
carp 112 CARP vrrp # Common Address Redundancy Protocol
pgm 113 PGM # PGM Reliable Transport Protocol
# 114 # any 0-hop protocol
l2tp 115 L2TP # Layer Two Tunneling Protocol
ddx 116 DDX # D-II Data Exchange
iatp 117 IATP # Interactive Agent Transfer Protocol
stp 118 STP # Schedule Transfer Protocol
srp 119 SRP # SpectraLink Radio Protocol
uti 120 UTI # UTI
smp 121 SMP # Simple Message Protocol
sm 122 SM # SM
ptp 123 PTP # Performance Transparency Protocol
isis 124 ISIS # ISIS over IPv4
fire 125 FIRE
crtp 126 CRTP # Combat Radio Transport Protocol
crudp 127 CRUDP # Combat Radio User Datagram
sscopmce 128 SSCOPMCE
iplt 129 IPLT
sps 130 SPS # Secure Packet Shield
pipe 131 PIPE # Private IP Encapsulation within IP
sctp 132 SCTP # Stream Control Transmission Protocol
fc 133 FC # Fibre Channel
rsvp-e2e-ignore 134 RSVP-E2E-IGNORE # Aggregation of RSVP for IP reservations
mobility-header 135 Mobility-Header # Mobility Support in IPv6
udplite 136 UDPLite # The UDP-Lite Protocol
mpls-in-ip 137 MPLS-IN-IP # Encapsulating MPLS in IP
manet 138 MANET # MANET Protocols (RFC5498)
hip 139 HIP # Host Identity Protocol (RFC5201)
shim6 140 SHIM6 # Shim6 Protocol (RFC5533)
wesp 141 WESP # Wrapped Encapsulating Security Payload (RFC5840)
rohc 142 ROHC # Robust Header Compression (RFC5858)
# 138-254 # Unassigned
pfsync 240 PFSYNC # PF Synchronization
# 253-254 # Use for experimentation and testing (RFC3692)
# 255 # Reserved
divert 258 DIVERT # Divert pseudo-protocol [non IANA]

network>

How to find which apps have listening ports open on Mac OS X

The darwin version of netstat on Mac OS X is derived from BSD. The flag system is different than the netstat you used on linux command line. One of the noticeable difference is -p flag is not used to find the process id.
On Mac OS X,  the following two lines work best to show which apps have listening ports open, and tunnel:

netstat -Watn | grep LISTEN
lsof -Pnl +M -i -cmd | grep LISTEN

Tuesday, March 20, 2018

got a phishing phone call from 9492884708

Got a phone call from 949-288-4708. The robot caller says: my name is xxx, I calls you because you recently requested lowering your credit card interest rate. This message is your last chance of response. Press 1 to talk to an operator.

 Mr. xxx didn't even mention what company he is working with.

I googled the number, it is not a public contact number.

it has been looked up 65 times in phone number reverse lookup system.

I put a scam report on that number and write this post as my response to that phone call.

7 good habits for securing your Mac OS X

Securing Mac OS X is comparably easier than securing windows. Firstly, Mac OS X don't share a common registry. Mac OS X applications keeps individual configuration files instead of sharing global configuration file, which greatly limited the severity and variety of malware.  Secondly, admin password is needed for installing applications on Mac OS X or allowing installed applications to access resources, which make hackers job even harder.

With good habits, we can further lower the risk of malware infection on your Mac OS X.
securing Mac OS X
securing Mac OS X


  1. Don't use admin account for your everyday work, use a regular user instead. If you have to browse dangerous websites, use guest account then log out after using. Regular user has limited access and restricted security policy, guest user has more restrictions and less area for exploration. Set a strong password even for regular users, this is important, you keychain stored all your online username and password, the regular user's password is the only thing between ****** and the clear text password for your bank account.
  2. Only install apps from App store, if have to, from App store and identified developers. If you are using a regular user, you really have no choice but comply.
  3. Don't turn off firewall. You can check if it is on in System Preferences -> Security & Privacy -> firewall.
  4. Don't turn off automatic update. Again it is default setting of the regular user. Keep your operation system and applications updated is critical to keep up with the latest vulnerability/bug fixing, thus makes your system less likely to be hacked. 
  5. Don't enable sharing services if possible. Sharing opens more ports for hacking, so use caution when you do.
  6. Don't download files from untrusted email or websites. Even though harder on Mac OS X, Trojan horse can still be downloaded and activated to your mac. Use common sense in this situation.
  7. Avoid visiting untrusted websites. Even though driving by infection is practically impossible on Mac OS X, annoying javascript such as endless popups can do damage to your laptop.
Note: few malware can do harm on Mac os x, however, install an anti-virus on Mac still has value, because when a dormant malware is copied from Mac to PC, it will be alive and do damage there. Don't pouring money on MacOS anti-virus, it is just not cost effective. A low cost anti-virus application can find security risks on your mac such as Adobe flash. After all, securing the end point is just one of the dimensions for network security.


7 good habits for securing your smartphone

Nowadays, smartphones are like a small computer -- it has dual cores, memory, virtual keyboard, camera, speaker, etc -- almost every functional units traditional computer has. It can access TV, USB, internet, wifi, vpn, ftp, sftp, vpn etc. It can host file server, web server, wifi hotspot ... You can browse webpages, edit word document, trade stock, transfer bank money, edit code, run anti-virus, scan ports, run password cracking app ... this list can go on and on until you are fully convinced that smartphones are real computers.

Smartphones start to draw attention from hackers since smartphones became more and more powerful and stores more and more valuable data within.

securing smartphones
securing smartphones


Securing smartphones are import and don't necessarily harder than securing a traditional laptop or desktop. Here are 7 good habits for securing your smartphone.


  1. Avoid publishing your cellphone numbers on the internet. 
  2. Don't root your android or jail-broken your iPhone (if you don't know what you are doing). Your default android and iPhone settings have many security mechanisms from your manufactures to protect the phone, root or jail-break breaks these system and makes your smartphone vulnerable to attackers.
  3. If you use iPhone, don't install apps outside App store. Period. If you use android, be cautious about apps from the play store, only install those apps with good reputation. Apple and google have rules for publishing/maintaining/retiring apps in App store and play store. Apps outside the official release channel are more likely have security holes or malicious intention.
  4. Don't enable Bluetooth and Personal Hotspot all the time. Avoid running service such as web server, file server for long period of time.
  5. Keep your OS and app updated. OS and app update will fix latest security issues.
  6. set a screen lock.
  7. Don't use webpage for online business, always use an app. If you don't root or crack your smartphone, no virus or worms can be installed on your smartphone without your permission, however, javascript from malicious webpages can do bad things to good webpages you opened at the same time in your browser such as XSS. Using the bank/hospital/e-store provided app instead.

Monday, March 19, 2018

cellphone might be used by hacker as a zambie

Got a strange phone call from number +7 187489177.

The phone is called from a robotic voice, it is about a very important mail has been attempted to deliver to me for 3 times and failed. This phone call is the last warning, for more detail, press 2. Once pressed 2, the robot on the other side spoke a few words then dropped.

My phone displayed the origin of this location is russia. However, the 718 phone should came from New York. Strange, someone might be hiding the real phone number. At least that guy get me pressed 2, verified my phone number is real. When I call back that phone number, it gets into voice mail. I hang up the phone and felt suspicious.

When I google the number 7187489177, I got some information about 71874891*, but no particular information about the exact number. When I search the 7187489177 with bing.com. It turns out the phone belongs to a 2001 founded company Skotar Construction Inc. located in Brooklyn, NY. When I call the phone number today, it is always busy.

I think what happened is, a hacker from russia used an automatic phone calling software to call random phone numbers, using a legitimate phone number as the displayed phone number. Since the mobile network recorded the caller origin, the number and the location didn't match. The caller was either collecting legitimate phone numbers for later use or called a large amount of legitimate phone numbers trying to deny of service the victims phone 7187489177 with tons of call backs. Since I did call 7187489177, I might become one of the zombie recruited by the hacker to do the deny of service to the victim's phone.

The correct way of handling the robocall is:

  1. check suspicious caller origin.
  2. if the caller is from robot, and the content smells, don't press any button to give them feedback.
  3. search the phone with both google.com and bing.com to make sense of the story, knowing the displayed phone number might be the victim instead of spammer. Either way, you don't want to call back the number.


Sunday, March 18, 2018

7 good habits for securing your blogspot

The blogspot is backed by google.com, who provided the webmaster tools for site optimization and security check.  These 7 good habits can make your blogspot account more secure.

securing blogspot

G

securing blogspot

  1. use a strong password as well as two factor authentication. Two factor authentication prevent hackers to brutal force your account, since they can not launch attack from any random device, the attack vector is much smaller. 
  2. regularly check the google webmaster tools. When there are security issues, you will receive message in the webmaster tool's search console. So form a habit of checking the messages and security issues in the webmaster tool search console.
  3. regularly check the search console's configurations. Check no new users are added, no configurations are added without your notice.
  4. regularly search your website in google. In google search field, type "site: <your site url>" should return good content instead of suspicious content.
  5. in your blogger post, avoid including content from third party site with javascript, if you have to do so, make sure content source is reputable.
  6. don't allow everybody to write comment on your blogger post. Spammers can use your site to advertise bad content, malicious persons can embedded bad code in the comment. 
  7. be careful when using third-party template. Third-party templates outside the official channel have better chance of containing malicious code and security vulnerabilities.

Wednesday, March 7, 2018

Prove your rest service received traffic


You can stop your rest service on server and have a network tool listen on the port, so that your know the problem is the network, not your program.

Send your rest calls as before (curl, wget, browser etc.), make sure the network tool get traffic.

Two example tools netcat and tcpdump (assuming your rest service listen on port 443):



nc -l -p 443
tcpdump -i eth0 port 443
[ Supporting files] [ Socialize This]

Find who changed a file (httpd.conf)

assuming you don't have a auditd enabled.

you can have an educated guess with:


grep -H httpd.conf /home/*/.bash_history
stat httpd.conf
[ Supporting files] [ Socialize This]

MarketAxess

MarketAxess: The Leader in e-Trading for Global Fixed Income MarketAxess Holdings Inc. (MarketAxess) is an international financial technol...