· 8 years ago · Feb 01, 2018, 08:10 PM
1security/privacy/anonymity notes (computer)
2
3TABLE OF CONTENTS
4•Security/privcy focused OSes with main security features
5•Virus & phishing detection
6•Domain Name System (DNS) security
7•Browser security/privacy Add-ons
8•Good email providers
9•security/privacy focus Search Engines
10•Anti-keyloggers
11•Firewalls
12•memory protection
13•Linux Kernel Security
14•BSD Kernel security
15•compiler security
16•hardware security
17•802.11 network security
18•Router security
19•vulnerability scanners
20•secure Microkernels
21•security by isolation programs
22•network intrusion prevention system (NIPS) and network intrusion detection system (NIDS)
23•host-based intrusion detection system (HIDS)
24•packet analyzers
25•network security scanner
26•disk encryption
27•security audit tools
28•Network and applications layer authentication and encryption methods
29•Executable space protections
30•server security suite
31•VPNS
32•proxies
33•distributing files anonymously
34•scan websites automatically for common vulnerabilities and errors that can de-anonymize the owner or users
35•easiest way to add an onion address to a traditional websites
36•proof that bugs can go undetected for atleast 1 year or more!
37•protection against Cross-Site Request Forgery (CSRF)
38•Preventing Remote File Inclusion (RFI) Attacks
39•cross site scripting (XSS) prevention
40•defenses against SQL injections
41•XPath Injection Defenses
42•problems that have not been solved yet
43•General and technical Notes
44
45-------------------------------------------------------------------------------------------------------
46Security/privcy focused OSes with main security features
47
48
49Subgraph OS: security by kernal namespaces isolation, The kernel is patched with an unofficial port of grsecurity/PaX, Tor, Metaproxy is configured to redirect outgoing connections to the Tor network, dm-crypt, noscript, apparmor, Application firewall,MAC spoofing with Macouflage, seccomp-bpf whitelisting and blacklisting as part of Oz,most of subgraph is coded in golang,disguise's a user's IP address,prevent ISP spying,Prevent websites from identifying the user,Prevent malware from identifying the user,Circumvent censorship,Hide Tor use from network observers,uses Xpra to isolate X11. (https://subgraph.com/sgos/)
50
51
52
53
54Qubes OS: security by VM isolation, Qubes relys on Xen to enforce domain isolation rather then a monolithic kernal that has millions of lines of coding,LUKS, Whonix,firewall,DispVM template,Type 1 hypervisor,USB VM, secure copy and paste operations, secure copying and transfer of files, and PDF/image sanitization,Yubikey,each AppVM has it own local isolated dummy X server.The main X server that runs in Dom0 and that handles the real display is never exposed to any of the AppVMs directly,and if used with whonix you are able to:1.disguise's a user's IP address 2.prevent ISP spying 3.Prevent websites from identifying the user 4.Prevent malware from identifying the user, 5.Circumvent censorship,Qubes uses hardware memory
55virtualization (HVM) instead of paravirtualization (PV),the Qubes architecture has been reworked to make it more simple,and to add more features more easily for developers,comes with SaltStack:allows administrators to easily configure their systems. (https://www.qubes-os.org/)
56
57
58
59
60
61OpenBSD: security by correctness, security by reduced code, buffer overflows or integer overflows resistant, has the strlcpy and strlcat functions,PF ('firewall' - packet filter plus tools), OpenSSH, Reduced attack surface:no loadable modules, relatively few devices, Virtually no compat code, removed entire Bluetooth stack, Significantly less syscalls (e.g. 200+ syscalls less than FBSD) Cut support for some older architectures, Code Quality:int overflows/signedness bugs, as good as gone in most places,Guard pages,Address space randomization,chroot jail daemons run in restricted environment,ProPolice random stack gap inserted, fixed returns fail,uses LibreSSL,W^X
62(https://www.openbsd.org/)
63
64
65
66
67
68
69Whonix: security by VM isolation, Tor ,uses apt-transport-tor for stream isolation,outgoing connections forced to go through Tor otherwise blocked, noscript,firewall, HTTPS everywhere,DNS leaks are impossible,replaces NTP with sdwdate, mechanism to disable Tor stacking,Malware with root privileges cannot discover the user's real IP address,Whonix is divided into two parts: Whonix-Workstation for work activities and Whonix-Gateway or proxy to enforce all Internet traffic routing via the Tor network. This security by isolation configuration averts many threats posed by malware, misbehaving applications, and user error,disguise's a user's IP address,prevent ISP spying,Prevent websites from identifying the user,Prevent malware from identifying the user,Circumvent censorship,Secure data transfer to and from a server with scp,Unobserved administration of servers via SSH,With the Whonix design, it is possible to "torify" applications which are not capable of proxy support by themselves,Hide Tor use from network observers,Hide installed software from network observers. (https://www.whonix.org/)
70
71
72
73
74
75Trusted End Node Security (TENS): security by reduced code, DNScrypt, does not mount a local hard drive, Administrator privileges are not required; nothing is installed,run entirely from the computer's RAM,firewall. (https://www.spi.dod.mil/download.htm) (warning this site appears to not be using https)
76
77
78
79
80
81The Amnesic Incognito Live System (TAILS): Tor,use state-of-the-art cryptographic tools, stream isolation,run entirely from the computer's RAM, LUKS, noscript, outgoing connections forced to go through Tor,firewall,disguise's a user's IP address,prevent ISP spying,Prevent websites from identifying the user,Prevent malware from identifying the user,Circumvent censorship. (https://tails.boum.org/)
82
83
84
85
86Alpine Linux:The kernel is patched with an unofficial port of grsecurity/PaX, and all userland binaries are compiled as Position Independent Executables (PIE) with stack smashing protection,run entirely from the computer's RAM, is built around musl libc and busybox. (https://www.alpinelinux.org/about/)
87
88
89
90
91
92NOTES
93
941.Tor helps to protects users by bouncing communications around a distributed network of relays run by volunteers all around the world. Without advanced, end-to-end, netflow correlation attacks, anybody watching a user's Internet connection cannot easily determine the sites visited, and those sites cannot learn the user's physical location. (https://www.whonix.org/wiki/About)
95
96
97
98
992.The public scrutiny of security by design has proven to be superior to security through obscurity.This principle asserts that systems must be secure, even if the adversary knows everything about how they work. (https://www.whonix.org/wiki/Why_Whonix_is_Free_Software)
100
101
102
103
1043.The user is usually the weakess part in security,when it comes to lack of user knowledge in cyber security defenses and what not to do,thats why its important to know as much as you can about cyber security not just installing security software or updating your OS,but knowing how everything works.
105
106
107
1084.In many parts of the globe, direct connections to the Tor network are censored. It is simple for censors to use technology to block connections, because it only requires maintenance of a real-time blacklist of all publicly known Tor (guard) relays and directory authorities.
109
110In order to try and solve this problem, the Tor project came up with the idea of making a proportion of Tor guard relays only available via relatively private channels. However, since these alternative guard relays ("vanilla bridges") use the same protocol to communicate with the Tor clients as normal guard relays, a censor can simply identify the Tor signature of the network connection and then block it.
111
112Tor developers have recognized that security by obscurity has failed many bridge users, because most are still blocked in repressive environments. This has led to the development of Pluggable Transports (PTs), which help to circumvent censorship by transforming the Tor traffic flow between the Tor client and the bridge so it appears to be "innocent" network traffic, instead of the actual Tor traffic.
113
114Unfortunately, traditional obfusticated bridges - obfs2, obfs3, obfs4 - still depend on censors being unaware of bridge information (like the IP address), which is still a security by obscurity approach. This allows aggressive censors to gradually block known obfusticated bridges by requesting the same information from the Tor Project BridgeDB, as any normal user would do.
115
116potential solution:Unlike traditional bridges, meek_lite utilizes the concept of collateral freedom.meek_lite has recently proven to perform better in circumventing censorship than other methods. For example, during the 19th National Congress of the Communist Party of China held last month, meek was one of the few effective tools to bypass strengthened Internet censorship. (https://www.whonix.org/blog/meek_lite-whonix-14)
117
118
119
120
121
122
1235.The privacy-oriented Linux distribution Tails does not
124support MAC address randomization during network scans.
125Instead, it generates a (new) random MAC address at boot.
126This random address keeps the first 3 bytes of the original
127address, the Organization Unique Identifier (OUI), and
128only randomizes the last three bytes. While not as optimal
129as periodical address changes, it does prevent tracking over
130extended periods of time.
131
132(http://papers.mathyvanhoef.com/asiaccs2016.pdf)
133
134
135
136
137
1386.Zero-day exploits are computer vulnerabilities, which have not yet been discovered.
139
140
141
142
1437.Because the OpenBSD project is based in Canada, no United States export restrictions on cryptography apply, allowing the distribution to make full use of modern algorithms for encryption. Encryption can be found almost everywhere in the operating system, from file transfers to file systems to networking. Pseudo-random number generators are also included in OpenBSD, which ensures that random numbers cannot be predicted based on the system state. Other features include cryptographic hash functions, cryptographic transform libraries, and cryptographic hardware support. (https://www.ibm.com/developerworks/aix/library/au-openbsd.html)
144
145
146
147
148
1498.OpenBSD pioneered IPSEC in general, with IPSEC in the base system since OpenBSD 2.1 (1997)
150(https://home.nuug.no/~peter/openbsd_and_you/#15)
151
152
153
154 9.PF, the OpenBSD packet filter, debuted in OpenBSD 3.0 (December 1, 2001)
155
156 Replaced IPFilter (ipf) due to performance and licensing
157
158 High-performance packet filter with (essentially) human-readable config
159
160 Ported to several other systems (FreeBSD → macOS, iOS, NetBSD → Blackberry, OpenBSD → Solaris)
161(https://home.nuug.no/~peter/openbsd_and_you/#16)
162
163
164
165
16610.Most (probably all) OpenBSD developers run OpenBSD on their laptops.
167(https://home.nuug.no/~peter/openbsd_and_you/#25)
168
169
170
171
172--------------------------------------------------------------------------------------
173Virus & phishing detection
174
175
176
177
178Malwarebytes Endpoint Security: Detects and removes zero-hour and known Trojans, worms, adware,spyware, and other malware,employs delete-on-reboot to remove persistent or deeply embedded malware,removes PUP (Potentially Unwanted Program),anti-ransomware technology,malicious website blocking,Real-time protection,Anti-rootkit,Maintains productivity by preserving system uptime and reducing the need for reimaging. Reduces the burden on the IT department,Identifies vulnerable endpoints and aggregates endpoint reporting. Includes XML logging in machine- and human-readable formats for robust analysis,Linking Engine:Signature-less technology that identifies and thoroughly removes all threat artifacts linked with the primary threat payload,Small system footprint. (https://www.malwarebytes.com/business/endpointsecurity/) (https://www.itcadence.net/services/cloud-security/)
179
180
181
182
183
184
185avast! Free: Provides on-access protection from viruses and other malware,Includes a "heuristics engine" to detect previously unknown threats,Includes real-time protection of files, email, web surfing, P2P transfers, instant messages, and even suspicious behavior (https://www.thebalance.com/avast-free-antivirus-2016-review-1356598)
186(https://www.avast.com/en-us/free-antivirus-download)
187
188
189
190
191
192webroot secure anywhere: Can recover files encrypted by ransomware. Uses tiny amount of disk space. Very fast scan. Handles unknown malware. Includes firewall.Webroot's cloud-based servers maintain a giant database of known programs, good and bad.When Webroot encounters an unknown program, it sends detailed telemetry to HQ for analysis, and starts monitoring that program. Every action by the suspect gets journaled for possible rollback. Of course, some events can't be rolled back. Transmitting data to an outside source is one example. Webroot doesn't let an unknown program perform that sort of action,that means a valid unknown program might not be fully functional for a while. (https://webrootsupports.weebly.com/)
193
194
195
196
197
198RKhunter (Rootkit Hunter): is a Unix-based tool that scans for rootkits, backdoors and possible local exploits. It does this by comparing SHA-1 hashes of important files with known good ones in online databases, searching for default directories (of rootkits), wrong permissions, hidden files, suspicious strings in kernel modules, and special tests for Linux and FreeBSD. (http://rkhunter.sourceforge.net/) (https://en.wikipedia.org/wiki/Rkhunter)
199
200
201
202
203
204chkrootkit: locally checks for signs of a rootkit (http://www.chkrootkit.org/)
205
206
207
208
209
210Rogue killer TKZY: is an anti-malware able to detect and remove generic malware and advanced threats like rootkits, rogues, worms.It also detects controversial programs (PUPs) as well as possible bad system modifications/corruptions (PUMs). (https://www.adlice.com/download/roguekiller/)
211
212
213
214
215
216
217virustotal: Analyze suspicious files and URLs to detect types of malware including viruses, worms, and trojans. File URL Search. (https://www.virustotal.com/#/home/upload)
218
219
220
221
222
223urlscan.io: allows you to scan a website and analyze the resources it requests and the domains it contacts. Understand what your website is doing.
224(https://urlscan.io/)
225
226
227
228UrlQuery.net: is a free online service for testing and analyzing URLs, helping with identification of malicious content on websites. The main focus of urlquery.net is to find and detect suspicious and malicious content on webpages, to help improve the security industry and make the internet a safer place.
229(https://urlquery.net/about)
230
231
232
233CheckPhish.ai: AI Powered Real-time Phishing Detection system.
234(https://checkphish.ai/)
235
236
237phishcheck.me: PhishCheck is designed to quickly gather the information required to investigate a suspicious website. Use PhishCheck to check what lies behind a suspicious URL. Our system will screenshot the website, gather information such as WHOIS, ASN, IP Address, IP Geolocation, and record all resources loaded by the website.
238(https://phishcheck.me/#features)
239
240
241
242Hybrid-Analysis.com: malware analysis service for the community that detects and analyzes unknown threats using a unique Hybrid Analysis technology,uses Payload Security's VxStream sandbox.
243(https://decentsecurity.com/#/malware-web-and-phishing-investigation/)
244(https://www.hybrid-analysis.com/)
245
246
247
248Malwr.com: Shares reports and files publicly.
249(https://decentsecurity.com/#/malware-web-and-phishing-investigation/)
250
251
252
253
254NOTES
2551.Antivirus tools are actually worse than useless. In the case of sophisticated and targeted attacks, the antivirus software can serve as a pathway to exploiting a system's kernel, since they almost always run with administration level privileges.Polymorphic code and kernel rootkits or hardware rootkits essentially render antivirus products helpless. (https://www.whonix.org/wiki/Malware)
256
257
258
2592.payloads can be completely obfuscated from antivirus detection, but the stub portion remains. The stub is a more difficult portion to obfuscate, because it must remain executable in order to properly perform its job of decrypting and running the original executable. Since the payload changes for each instance, antivirus signatures have to match on the stub portion in order to be able to match more than a single individual piece of malware.In order to obfuscate the stub program, a unique stub generator (USG) can be used. The generator might insert random data in certain unused locations of the stub. It might insert randomized executable operations that have no effect. It might substitute or reorder certain portions of the code. The USG attempts to create a stub that is both unique and that contains as small of an unchanging portion of code as possible to make signature creation more difficult.It is expected that a FUD product will have a relatively short useful lifespan before antivirus companies can reliably detect executables that have been created by it.
260
261
262the next step in detecting malware is behavior- and reputation-based technologies not depending on signatures. If effective, tricks such as FUD cryptors may be made obsolete by improvements to behavior- and reputation-based detection.
263(https://www.symantec.com/connect/blogs/fully-undetectable-cryptors-and-antivirus-detection-arms-race)
264
265
266
2673.cloud AVs
268(https://www.blackhat.com/docs/us-17/thursday/us-17-Kotler-The-Adventures-Of-Av-And-The-Leaky-Sandbox.pdf)
269
270
271
2724.reporting phishing websites tip:
273
274Right-click the link in the phishing email, and copy the hyperlink. Do not click the link, which is less useful to security companies.
275(https://decentsecurity.com/#/malware-web-and-phishing-investigation/)
276--------------------------------------------------------------------------------------------
277Domain Name System (DNS) security
278
279
280quad9: blocks against known malicious domains, preventing your computers and IoT devices from connecting malware or phishing sites. Whenever a Quad9 user clicks on a website link or types in an address into a web browser, Quad9 will check the site against the IBM X-Force threat intelligence database of over 40 billion analyzed web pages and images. Quad9 also taps feeds from 18 additional threat intelligence partners to block a large portion of the threats that present risk to end users and businesses alike. (https://www.quad9.net/#/about)
281
282
283
284
285Tenta DNS: is a modern, secure DNS alternative that supports both ICANN and OpenNIC roots, DNS over TLS and DNSSEC (DNS Security Extensions).Tenta is also written in written in Golang! (https://tenta.com/blog/post/2017/11/introducing-tenta-dns)
286
287
288
289OpenDNS
290
291
292
293
294DNScrypt
295
296
297
298DNSSEC
299
300
301
302
303DNS over TLS (https://tools.ietf.org/html/rfc7858)
304
305
306
307
308NOTES
3091.onion services don't use the insecure Domain Name System (DNS), which means there is no organization like ICANN to oversee a single root registry of onion addresses or to handle ownership dispute resolution of onion addresses. Instead, onion services get strong authentication from using self-authenticating addresses: the address itself is a cryptographic proof of the identity of the onion service. When a client visits an onion service, Tor verifies its identity by using the address as ground truth. (always use onion addresses on tor)
310
311
312
3132.DNSCrypt provides a panacea to the woes plaguing DNS. It encrypts both the question and answer, making them invisible to snoopers. It also effectively signs the message, so you know that the server you contacted really sent the answer and not an impostor. It's as if someone blocked out the messages on your postcard and the postcard you receive back includes a signature.
314
315Although DNSCrypt provides a significant security advantage, it comes with other disadvantages:
316
317Not completely encrypted: Even though the domain requested (question) and IP address (answer) is hidden, the complete process is not obfuscated. The total number of questions, their relative size and more remain available. Furthermore, it remains trivial to identify that you are, in fact, performing DNS resolution.
318
319Complex and not well supported: In the world of encryption, it's always safer to go with standardized protocols that have gone through a rigorous review process. Unfortunately DNSCrypt has not been standardized yet, and some of the ways it uses cryptography are unusual.
320
321Hard to use: Because DNSCrypt isn't standardized, very few programs natively support it, requiring users to download and configure helper applications, significantly increasing the difficulty of use and risk of misconfiguration.
322
323
324
3253.DNS over TLS takes a completely different approach, establishing a fully encrypted tunnel between your computer and the DNS server. Rather than sending requests in the clear, with just the critical data encrypted, the whole connection is encrypted. Furthermore, since TLS is the encryption protocol used to secure almost all other internet services, the technology is well understood and constantly improved.
326
327--------------------------------------------------------------------------------------------------------
328Browser security/privacy Add-ons
329
330
331HTTPS everywhere
332
333
334Noscript
335
336
337WOT
338
339
340Ghostery
341
342
343Ublock origin
344
345
346Privacy Badger
347
348
349User Agent Switcher
350--------------------------------------------------------------------------------------------------------
351Good email providers
352
353
354Riseup.net:collective dedicated to providing private and secure hosting, listing and mail services for individuals and organisations who are committed to political and social justice.Their services are free and Riseup does not monitor your activity,RiseUp operates exclusively over the Secure Sockets Layer (SSL),leaving Alternate email field empty will provide better privacy, but will not let you reset your password for this account in case you forget it.Riseup is currently using Roundcube, a free and open source web mail interface. Roundcube require JavaScript. If you prefer not to use it, Riseup also lets you access your email with SquirrelMail (see below). Riseup web mail also need your browser to accept cookies If you are using a public or shared computer (for example in an Internet café, community centre or library), you can enter your password by using the virtual keyboard. It offers your email account another layer of protection from key-logger programs.
355
356
357
358Protonmail:requires two passwords, which provides an added layer of protection.The login password gets sent to the server, and that’s how you prove that your username is actually yours. And the second is the mailbox password, which never gets sent to ProtonMail’s server. The second password runs in your browser and decrypts your messages there.stores your email encrypted to disk which means the emails would be undecipherable without your password if a government agency compelled the company to hand over your communications.
359
360
361
362Icedove (you should add these two add-ons Enigmail and TorBirdy.)
363
364
365
366I2P-Bote: has automatic encryption and signing without relying on third-party software such as PGP/GnuPG.
367
368
369
370BitMessage
371
372
373
374
375
376
377NOTES
3781.Use split-GPG for email to reduce the risk of key theft used for encryption / decryption and signing.
379
380
3812.Create an AppVM that is exclusively used for email and change the VM's firewall settings to only allow network connections to the email server and nothing else ("Deny network access except...").
382
383
3843.Only open untrusted email attachments in a DisposableVM to prevent possible infection.
385
386
3874.Although RiseUp is a secure email service managed by trustworthy advocates of Internet privacy and security, an unusual email service may attract unwarranted attention. It might make more sense in some situations, to blend in by using a popular email service in your country.
388
389
3905.One of the big issues is that it isn't easy to know whether a message sent to another ProtonMail user is being encrypted to the recipient’s correct public key, which is stored on ProtonMail’s keyserver. For example, if Alice sends Bob a message encrypted to his public key, it's harder for anyone else to read the message. But since ProtonMail distributes the encryption keys to users, it has the technical ability to give Alice its own keys in addition to Bob’s, thus encrypting the messages in a way that would allow it to eavesdrop.This problem is not unique to ProtonMail, says Joseph Bonneau, a technology fellow at the Electronic Frontier Foundation. Apple's iMessage and the now-encrypted WhatsApp have the same flaw. (Services like TextSecure, Silent Circle, and Threema, on the other hand, allow users to verify fingerprints to assure that they have the proper keys for one another, thus mitigating that threat.)Thats why its recommanded to use split-GPG with Protonmail.
391
392
393
3946.Email identities were really easy to spoof back in the 90s and early 2000s. Changing the “From†header field was enough to make friends believe an email came from their mother, significant other, or even the FBI. There were websites specially made for this purpose.However, those tricks no longer work thanks to anti-spoofing protections such as DMARC (DKIM / SPF) and anti-spam filters. Today, emails with a spoofed “From†field either go to the spam folder or are completely rejected by the server.Email usage is higher than ever and email is used for everything – from tracking parcels to sharing sensitive data. Unfortunately email is already not a very secure way to communicate.We’ve seen a lot of malware spreading via emails, relying on social engineering techniques to convince users to open unsafe attachments, or click on phishing links. The rise of ransomware distributed over email clearly demonstrates the effectivity of those mechanisms.
395
396
397
3987.list of email providers vulnerable to mailsploit https://docs.google.com/spreadsheets/d/1jkb_ZybbAoUA43K902lL-sB7c1HMQ78-fhQ8nowJCQk/edit#gid=0
399--------------------------------------------------------------------------------------------------------
400security/privacy focus Search Engines
401
402
403
404DuckDuckgo
405
406
407Startpage
408
409
410Disconnect
411
412--------------------------------------------------------------------------------------------------------
413Anti-keyloggers
414
415
416Zemana AntiLogger
417
418KeyScrambler
419
420
421
422NOTES
4231.Using a virtual keyboard can help protect against keyloggers.Key-logger programs are designed to monitor user's physical key strokes to record passwords, usernames and other vital information. Virtual keyboard allow users to circumvent this security vulnerability, by letting the user enter their password using the mouse.
424
425--------------------------------------------------------------------------------------------------------
426Firewalls
427
428
429
430Next Generation Firewall check point
431
432
433
434Barracuda NextGen Firewall (NGF)
435
436
437
438IPFire: Updates are digitally signed and encrypted, as well as can be automatically installed by Pakfire (the IPFire package management system). Since IPFire 2.15, the IPFire Linux kernel is patched with the grsecurity patchset, which pro-actively hardens the kernel against various forms of attacks. Most importantly, it protects from zero-day exploits by eliminating entire bug classes and exploit vectors. It makes stack buffer overflows almost impossible to exploit and comes with strict access controls, that make it harder for attackers to cause harm to the system. IPFire employs a Stateful Packet Inspection (SPI) firewall, which is built on top of netfilter (the Linux packet filtering framework),the firewall can be used to control outbound Internet access from any segment,SquidGuard is a URL filter add-on which is connected via the redirector mechanism of the proxy.The package manager Pakfire offers the addon SquidClamAV - a virus scanner for the web proxy. This checks in real-time all web traffic for viruses, utilizing the ClamAV virus definitions and scanning engine.IPFire is also able to use various random hardware number generators to seed the kernel's entropy pool.In contrast to SSL-VPNs, IPsec is hard to set-up. In IPFire, we thought about how to make this technology easy-to-use and as a result, there is a web user interface that handles all settings and takes care of the rest of the configuration for you.It also keeps the tunnels alive and re-establishes them automatically after a remote site has lost the connection.If someone scans the ports of the IPFire-System to see which services are available, the IDS will immediately notice it.
439(https://www.ipfire.org/features)
440
441
442
443Smoothwall Express: supports,Outbound filtering,Timed access,Traffic stats, including per interface and per IP totals for weeks and months,IDS via automatically updated Snort rules,List of bad IP addresses to block,Responsive web interface using AJAX techniques to provide realtime information,Log viewers for all major sub-systems and firewall activity.
444(http://www.smoothwall.org/about/express-feature-list/)
445
446
447
448
449Berkeley Packet Filter (BPF): BPF supports filtering packets, allowing a userspace process to supply a filter program that specifies which packets it wants to receive.Able to filter packets at the kernel level . BPF was designed to be indepented,as such it treats the packets as raw buffers.Each BPF filter is verified before attaching it to a socket.(https://en.wikipedia.org/wiki/Berkeley_Packet_Filter)
450(https://www.slideshare.net/kerneltlv/berkeley-packet-filters)
451
452
453
454NOTES
4551.Network intrusion detection systems rely on one, or more means of traffic analysis in order to determine whether or not a given stream of network traffic is suspicious. Network analysts, and system administrators can make use of stateless traffic filters to help them understand what is going on inside of their network(s), where such filters can be used for traffic inspection, filtering, and shaping.
456
457Packets can be filtered based on physical characteristics of the packet header (i.e. the signature) or based on one or more heuristics which would flag the packet as anomalous. (http://tylerfisher.org/bpf/)
458
459
460
4612.If your firewall works by blocking ports, then you can tell Tor to only use the ports when you start your Tor Browser. Or you can add the ports that your firewall permits by adding "FascistFirewall 1" to your torrc configuration file. By default, when you set this Tor assumes that your firewall allows only port 80 and port 443 (HTTP and HTTPS respectively). You can select a different set of ports with the FirewallPorts torrc option.
462
463
4643.In complete and utter disregard for the IETF, unused network ports should provide no response even via ICMP. ICMP should be disabled as far as possible.
465 (https://www.quora.com/What-desktop-OS-kernel-is-the-most-hardened-the-most-unhackable)
466
467
468--------------------------------------------------------------------------------------------------------
469memory protection (memory corruption,userland memory protection,direct memory access (DMA),Return Oriented Programming (ROP),heap protection,Metadata protection etc.)
470
471
472
473MAT - Metadata Anonymisation Toolkit
474
475Why MAT is not the ultimate solution?
476Mat only removes metadata from your files, it does not anonymise their content, nor handle watermarking, steganography, or any overly customized metadata field/system. Also please note that MAT does its best to scrub as much metadata as possible, it's not really efficient at scrubbing embedded media inside complex formats. For examples, images embedded inside PDF may not be cleaned.
477
478
479
480
481ptmalloc2: was forked from dlmalloc.During early days of linux, dlmalloc was used as the default memory allocator. But later due to ptmalloc2’s threading support, it became the default memory allocator for linux. has undergone several recent changes as of version 2.3.4 it contains numerous security enhancements,increasing the difficulty of exploiting heap corruption vulnerabilities. The glibc heap now contains safe unlinking, and a bunch of other features that raise the bar of exploitation significantly, however, these changes are still relatively minor - and are quite different from the fundamental changes that OpenBSD is making.
482
483
484
485phkmalloc:if you're running one of the BSDs, you're probably running phkmalloc.In practice, phkmalloc has been a little bit more difficult to exploit, though I don't think that this was so much an intentional feature as much as a side effect of the algorithm. It will suffice to say that the two algorithms are distinct and different.
486
487
488
489phkmalloc vs ptmalloc2:Fundamentally, they're both trying to solve the same problems, and both of them are quite effective - I certainly don't want to downplay the effects of the recent changes to ptmalloc2. Perhaps the only fundamental difference between the two, from the perspective of an end-user, is that the OpenBSD implementation will do a better job of preventing heap exploitation through heap data corruption (as opposed to heap management data corruption - sorry if the difference between the two isn't obvious), and the OpenBSD implementation will complain loudly (crash) almost every time there is a problem.
490
491
492
493PartitionAlloc:PartitionAlloc, part of the Google Chrome web browser. It has an out-of-line metadata design such that heap metadata is partitioned or guard paged off from the calling program's buffers. The notable exception, shared with tcmalloc, is freelist pointers, which occupy the freed slots. In PartitionAlloc, freelist pointers are transformed so that dereferencing them faults, and partial pointer overwrites are thwarted.While writing PartitionAlloc, strictly protected heap metadata was a goal. After all, if the metadata is naturally guarded with guard pages then there's less need for code defenses which are trying to detect and stop bad side effects from metadata corruption. Simplicity wins.However, there's an interesting interaction with single byte overflows that provides pause for thought and philosophizing.With an out-of-line metadata design, a single byte overflow off the end of a chunk will hit the first byte of some other chunk. Depending on the different object types that could be in the adjacent chunk, that's potentially a lot of possibilities for the attacker to explore.
494
495
496
497
498
499Address space layout randomization (ASLR):Attackers are able to a priori pick the right code pieces because parts of the code image of the vulnerable application remain static across different installations. Address space layout randomization (ASLR) is meant to prevent this kind of code reuse by randomizing the locations of the executable segments of a running
500process. However, in both Linux and Windows, parts of the address space do not change due to executables
501with fixed load addresses, or shared libraries incompatible with ASLR. Furthermore, in some
502exploits, the base address of a DLL can be either calculated dynamically through a leaked pointer,
503or brute-forced.
504
505
506
507
508Selfrando:randomizes Tor browser code to ensure that an attacker doesn't know where the code is on your computer. This makes it much harder for someone to construct a reliable attack--and harder for them to use a flaw in your Tor Browser to de-anonymize you.Software written in C and C++ is exposed to exploitation of memory corruption. Compilers and operating systems include various exploit mitigation mechanisms that prevent certain offensive techniques. Unfortunately, standard mitigations lag behind the offensive techniques used in exploits against browsers, servers, and other frequently targeted software and do not stop a well-resourced adversary.selfrando can be used to harden your software beyond what is possible with current mitigations. Inspired by biodiversity in nature and existing randomizing defenses, selfrando varies the attack surface, i.e., the code layout, by randomizing each function separately. This makes exploit writing harder and increases resilience to information leakage relative to traditional address space layout randomization (ASLR) techniques.
509
510
511
512
513
514RELRO:Hardens ELF programs against loader memory area overwrites by having the loader mark any areas of the relocation table as read-only for any symbols resolved at load-time ("read-only relocations"). This reduces the area of possible GOT-overwrite-style memory corruption attacks. (included in gresecurity)
515
516
517
518
519PAX_USERCOPY:kills heap overflow bug when the memory copy occurs between userspace and kernel space in either direction. The 1st version developed by Spender in 2009 and added into PaX later. HARDENED_USERCOPY is part of PAX_USERCOPY being ported to linux kernel in v4.8.
520
521
522
523
524
525KERNEXEC (included in gresecurity): prevents the kernel from executing data that is writable (including userland data). So modifying the IDT would be mitigated as well.
526(http://blog.siphos.be/2013/05/looking-at-the-local-linux-kernel-privilege-escalation/)
527
528
529
530
531
532UDEREF stronger than Supervisor Mode Access Prevention (SMAP) (included in gresecurity): The kernel will not de-reference userland pointers in contexts where it expects only kernel pointers. This feature cannot be disabled while the kernel is running.
533(https://wiki.gentoo.org/wiki/Hardened/PaX_Quickstart)
534
535
536
537
538KERNSEAL (included in gresecurity)
539
540
541
542
543STRUCTGUARD (included in gresecurity)
544
545
546
547
548
549Reuse Attack Protector (RAP):RAP is the state of the art in CFI defense and is a ROP mitigation technique,RAP's tags don't depend on the secrecy of the tag values themselves,neither kbouncer nor code randomization can do anything about function pointer hijacking -- RAP ensures that a function pointer can only be used to call a real function, not a gadget, and only a function whose type matches the type hash identified during compile time,and thanks to RAP,Stack Smashing Protector (SSP) is no longer needed.(included in gresecurity)
550
551
552
553
554
555kBouncer:an efficient and fully transparent ROP mitigation technique that does not requires source code or debug symbols. kBouncer is based on runtime detection of abnormal control transfers using hardware features found on commodity processors. Issues:kbouncer applies its checks using the expensive LBR stack. It's thus only able to apply the checks to the system API level (and then generally only to a subset of those functions, as done in the kbouncer implementation in EMET) to maintain adequate performance. The LBR stack is also limited in size, limiting the call depth that kbouncer can reasonably validate.
556
557
558
559
560In-place code Randomization:ROP mitigation technique,does not require symbolic debugging information,It is applied directly in third party executables,Does not introduce any runtime overhead,Experimentally proved to be effective against windows 7 ROP attacks,It can also be combined with existing security techniques to further increase the randomization
561entropy,but code randomization techniques are vulnerable to arbitrary read vulnerabilities.While RAP is designed to work in the presence of arbitrary reads and arbitrary writes at arbitrary times.
562
563
564
565
566
567Heap corruption mitigations:heap integrity checks, guard pages, and allocation order randomization
568
569
570
571
572
573IOMMU:Thanks to IOMMU,PCI cards are more resisant to Direct Memory Access (DMA) based attacks.
574
575
576
577
578
579You can go to the extreme and turn DMA completely off,losing a huge performance gain from DMA of course.
580
581
582
583
584
585Refuse access to DMA access memory by external devices until after the Windows OS is in control to parse DMA requests.
586
587
588
589
590
591Ensure unnecessary ports that allow attackers to perform a DMA attack (such as FireWire, Thunderbolt, ExpressCard, PC Card or any other PCI/PCIe Hardware interfaces) are disabled in the Operating Environment, and that normal users are prevented from altering such settings.
592
593
594
595
596
597Ensure devices are always secured with the use of some form of power up authentication either thru a BIOS power on password or Pre-Boot Authentication (PBA) from a full disk encryption (FDE) product.
598
599
600
601
602
603If devices are deemed to operating in an unsecure environment, be sure to require the use of hibernation mode and power off when not in use to prevent DMA attacks.
604
605
606
607
608
609
610No-eXecute (NX) is a processor feature that allows marking of memory pages as non-executable. The feature allows the CPU to help guard the system from attacks by malicious software. When the NX feature is enabled on a system, it prevents malicious software code from being placed in accessible regions of memory to be executed when control reaches that memory location.This was originally invented by AMD.
611
612
613
614
615
616XD is the acronym for eXecute Disable, which is an Intel specific implementation of NX. It refers to the same feature but Intel chose to call it by a different name.
617
618
619
620
621XN is the ARM equivalent of the same feature and is the acronym for eXecute Never.
622
623
624
625
626Essentially, both NX, XD and XN are the same and are different names for the same feature in AMD, Intel and ARM respectively.
627
628
629
630
631
632
633 NOTES
6341.Let’s discuss using FDE as a mitigation as the implementation can be tricky: With most encryption products that provide Data-At-Rest (DAR) security, once a legitimate user has successfully authenticated at Pre-Boot, the drive is thereafter “unlocked†and its contents are readable by the operating system and/or any other processes. If the threat of DMA attacks is considered a major risk, then the primary protection against this is to use interactive Pre-Boot Authentication.
635
636Some FDE solutions allow for unattended Pre-Boot Authentication (for example BitLocker with TPM protection). Thus even if the device is powered off when stolen, the attacker can power on the device and it will boot to the OS; similar issues apply to power modes such as Sleep. Thus, the use of unattended PBA is not recommended to ensure an attacker is prevented from launching such an attack. (Note: There are circumstances, depending on the risk profile, where unattended PBA via pre-boot networking with a management server acting as the external authenticator mitigates the risk. Another possible mitigation is to utilize Intel Enterprise Digital Fence.
637
638A DMA-based attack on software encryption is to gain access to the software Encryption Key as well as all sensitive data that is currently in memory. The primary mitigation against such an attack is to use Pre-Boot Authentication with single or multi-factor strong credentials.
639
640A DMA-based attack on a hardware-encrypted drive (SED) such as an Opal drive is an attempt to gain access to the PIN in memory (if it’s stored) that unlocks the SED returning from Sleep mode. The primary mitigation against this attack is also the use of Pre-Boot Authentication coupled with disabling support of Sleep for the system. The use of Sleep mode for Self-Encrypting Drives should be strongly cautioned.
641
642
643
644
645
6462.Due to how modern computing works, basically everything that you have done during a session is stored in the RAM. If an attacker has physical access to your computer when you are running Whonix, it may enable her to recover everything that have been achieved during the session - even if you are using Full Disk Encryption. From typed texts to saved files, including passwords and encryption keys. The more recent the activity, the more likely it is that it is still in the RAM.
647
648Furthermore, it has been shown that the data present in the RAM might be recoverable for seconds or even minutes after the computer is powered off using a cold boot attack.
649
650Wipe RAM on shutdown (e.g. using a kexec script) - or do not leave the computer unattended immediately after shutdown. Unfortunately there is not yet an upstream script, to implement wiping the RAM on shutdown. We can not provide a solution for this attack, this is solved nowhere but partially in Tails and Liberte Linux (not checked), waiting for upstream solution.
651
652
653
654
655
6563.Heap corruption vulnerabilities are one of the most common types of vulnerability that Microsoft addresses through security updates today. These vulnerabilities typically occur as a result of programming mistakes that make it possible to write beyond the bounds of a heap buffer (a spatial issue) or to place a heap allocated object in an unexpected state such as by using the object after it has been freed (a temporal issue).
657
658
659
660
6614.Return-oriented programming (ROP) has become the primary exploitation technique for
662system compromise in the presence of non-executable page protections. ROP exploits are
663facilitated mainly by the lack of complete address space randomization coverage or the presence
664of memory disclosure vulnerabilities, necessitating additional ROP-specific mitigations.
665Existing defenses against ROP exploits either require source code or symbolic debugging
666information, or impose a significant runtime overhead, which limits their applicability for
667the protection of third-party applications.
668
669
670
671
6725.Other defenses against code-reuse attacks complementary to ASLR include compiler extensions,
673code randomization, control-flow integrity, and runtime solutions. In practice,
674though, most of these approaches are almost never applied for the protection of the COTS software currently
675targeted by ROP attacks, either due to the lack of source code or debugging information, or due to their
676increased overhead.
677
678
679
680
681
6826.As code-reuse attacks require precise knowledge of the structure and location of the code to
683be reused, diversifying the execution environment or even the program code itself is a core
684concept in preventing code-reuse exploits.
685
686
687
688
689
690
6917.Address space layout randomization is probably one of the most widely deployed countermeasures against code-reuse attacks. However, its effectiveness is hindered by code segments left in static locations,while, depending on the randomization entropy, it might be possible to circumvent it using brute-force guessing. Even if all the code segments of a process are fully randomized, vulnerabilities that allow the leakage of memory contents can enable the calculation of the base address of a DLL at runtime.
692
693
694
695
696
697
6988.Intra-DLL randomization at the function, basic block, or instruction level can provide protection for executables
699that do not support ASLR, or against de-randomization attacks through memory leaks.
700
701
702
703
704
705
7069.JOP is similar to ROP, but it uses indirect jump instructions instead of returns to transfer
707control from gadget to gadget. Clearly, constructing JOP programs is far more difficult than ROP because
708the attacker has to maintain a memory region with the payload and manually advance the pointer to the
709next gadget and transfer control to it. The same functionality is conveniently achieved by a single return
710instruction in ROP.
711
712
713
714
71510.Stack/heap protectioned provided by linux kernel has only one single page( 4KB by default in i386) due to some compatibility issues. PaX's implementation doesn't have this problem and its gap is 64KB by default. You can set the number at runtime via "sysctl vm.heap_stack_gap"( We have another auditing item for the hardening solution. Thanks to the full disclosure).
716
717
71811.Use POP3 and SMTP settings, as IMAP leaks more metadata.
719
720
72112.Since onion services are part of the Tor network, the services and the people connecting to them get more security and privacy; their traffic doesn't even leave the network,the onion services are relied on for metadata-free chat and file sharing.
722
723--------------------------------------------------------------------------------------------------------
724Linux Kernel Security
725
726
727Gresecurity: is a set of patches for the Linux kernel which emphasize security enhancements,such as 1.Preventing direct userland access by kernel. 2.Bounds checks on kernel copies to/from userland. 3.ASLR. 4.Prevents userland code execution by kernel. 5.Prevents kernel stack overflows on x64. 6.Hardened userland memory permissions. 7.Random padding between thread stacks. 8.Hardened BPF JIT against spray attacks. 9.Automatically responds to exploit bruteforcing. 10.Chroot hardening. 11.Prevents users from tricking Apache into accessing other users' files. 12.Provides Trusted Path Execution. 13.role-based access control (RBAC).Just to name a few features.
728
729
730
731
732
733PaX: A major component bundled with grsecurity is PaX. Among other features, the patch flags data memory, the stack, for example, as non-executable and program memory as non-writable. The aim is to prevent memory from being overwritten, which can help to prevent many types of security vulnerabilities, such as buffer overflows. PaX also provides address space layout randomization (ASLR), which randomizes important memory addresses to reduce the probability of attacks that rely on easily predicted memory addresses.
734
735
736
737
738
739secure computing mode (Seccomp) (merged into the Linux kernel mainline in kernel version 2.6.12): is a computer security facility in the Linux kernel,seccomp allows a process to make a one-way transition into a "secure" state where it cannot make any system calls except exit(), sigreturn(), read() and write() to already-open file descriptors. Should it attempt any other system calls, the kernel will terminate the process with SIGKILL. In this sense, it does not virtualize the system's resources but isolates the process from them entirely.
740
741
742
743
744cgroups: is a Linux kernel feature that limits, accounts for, and isolates the resource usage (CPU, memory, disk I/O, network, etc.) of a collection of processes.
745
746
747
748
749STACKLEAK: -reducing the information that can be revealed through kernel stack leak bugs
750 - blocking some uninitialized stack variable attacks
751 - introducing some runtime checks for kernel stack overflow detection
752
753
754
755
756
757KernelAddressSanitizer (KASAN) (included in the Linux kernel 4.0): Detects OOB for both writes and reads,provides strong UAF detection (based on delayed memory reuse),Does prompt detection of bad memory accesses,Prints informative reports.
758
759
760
761
762
763/dev/mem protection: Some applications (Xorg) need direct access to the physical memory from user-space. The special file /dev/mem exists to provide this access. In the past, it was possible to view and change kernel memory from this file if an attacker had root access. The CONFIG_STRICT_DEVMEM kernel option was introduced to block non-device memory access (originally named CONFIG_NONPROMISC_DEVMEM). (included in the Linux kernel 2.6.25)
764
765
766
767
768
769
770
771/proc/$pid/maps protection: With ASLR, a process's memory space layout suddenly becomes valuable to attackers. The "maps" file is made read-only except to the process itself or the owner of the process. Went into mainline kernel with sysctl toggle in 2.6.22. The toggle was made non-optional in 2.6.27, forcing the privacy to be enabled regardless of sysctl settings (this is a good thing). (Becames non-optional in Linux kernel 2.6.27)
772
773
774
775
776
777
778
779runtime memory allocation validation:Detect double-frees in kernel space.
780
781
782
783
784
785
786Restricting access to kernel logs: The kernel logs contain useful information for an attacker trying to exploit kernel vulnerabilities, such as sensitive memory addresses. The kernel.dmesg_restrict flag was to forbid access to the logs without the CAP_SYS_ADMIN capability (which only processes running as root have by default).
787
788
789
790
791
792
793Restricting access to kernel pointers in the proc filesystem: Enabling kernel.kptr_restrict will hide kernel symbol addresses in /proc/kallsyms from regular users without CAP_SYSLOG, making it more difficult for kernel exploits to resolve addresses/symbols dynamically. This will not help that much on a pre-compiled Arch Linux kernel, since a determined attacker could just download the kernel package and get the symbols manually from there, but if you're compiling your own kernel, this can help mitigating local root exploits. This will break some perf commands when used by non-root users (but many perf features require root access anyway).
794
795
796
797
798Keep BPF JIT compiler disabled: The Linux kernel includes the ability to compile BPF/Seccomp rule sets to native code as a performance optimization. The net.core.bpf_jit_enable flag should be left at 0 for a maximum level of security.
799This can be helpful in specific domains, but is not usually useful. A JIT compiler opens up the possibility for an attacker to perform a heap spraying attack, where they fill the kernel's heap with malicious code. This code can then potentially be executed via another exploit, like an incorrect function pointer dereference. (gresecurity's GRKERNSEC_BPF_HARDEN solves this)
800
801
802
803
804ptrace scope: Arch enables the Yama LSM by default, providing a kernel.yama.ptrace_scope flag. This flag is enabled by default and prevents processes from performing a ptrace call on other processes outside of their scope without CAP_SYS_PTRACE. While many debugging tools require this for some of their functionality, it is a significant improvement in security. Without this feature, there is essentially no separation between processes running as the same user without applying extra layers like namespaces. The ability to attach a debugger to an existing process is a demonstration of this weakness.
805
806
807
808
809
810hidepid: The kernel has the ability to hide other users' processes, normally accessible via /proc, from unprivileged users by mounting the proc filesystem with the hidepid= and gid=,this greatly complicates an intruder's task of gathering information about running processes, whether some daemon runs with elevated privileges, whether other user runs some sensitive program, whether other users run any program at all, makes it impossible to learn whether any user runs a specific program (given the program doesn't reveal itself by its behaviour), and, as an additional bonus, poorly written programs passing sensitive information via program arguments are now protected against local eavesdroppers.
811
812
813
814
815dmesg restrictions: When attackers try to develop "run anywhere" exploits for vulnerabilties, they frequently will use dmesg output. By treating dmesg output as sensitive information, this output is not available to the attacker. Starting with Ubuntu 12.04 LTS, /proc/sys/kernel/dmesg_restrict can be set to "1" to treat dmesg output as sensitive. Ubuntu Touch kernels have this enabled by default.
816
817
818
819
820Block kexec: Starting with Ubuntu 14.04 LTS, it is now possible to disable kexec via sysctl. CONFIG_KEXEC is enabled in Ubuntu so end users are able to use kexec as desired and the new sysctl allows administrators to disable kexec_load. This is desired in environments where CONFIG_STRICT_DEVMEM and modules_disabled are set, for example.
821
822
823
824
825Kernel Address Display Restriction: When attackers try to develop "run anywhere" exploits for kernel vulnerabilities, they frequently need to know the location of internal kernel structures. By treating kernel addresses as sensitive information, those locations are not visible to regular local users. Starting with Ubuntu 11.04, /proc/sys/kernel/kptr_restrict is set to "1" to block the reporting of known kernel address leaks. Additionally, various files and directories were made readable only by the root user: /boot/vmlinuz*, /boot/System.map*, /sys/kernel/debug/, /proc/slabinfo
826
827
828
829
8300-address protection: Since the kernel and userspace share virtual memory addresses, the "NULL" memory space needs to be protected so that userspace mmap'd memory cannot start at address 0, stopping "NULL dereference" kernel attacks. This is possible with 2.6.22 kernels, and was implemented with the "mmap_min_addr" sysctl setting. Since Ubuntu 9.04, the mmap_min_addr setting is built into the kernel. (64k for x86, 32k for ARM.)
831
832
833
834PAX_REFCOUNT: Reference counter overflow bug can be exploited in scenario where UAF( Use-After-Free) comes into game. PAX_REFCOUNT killed this kind of bug class.It can protects the kernel against integer overflows.
835
836
837
838PAX_MEMORY_SANITIZE: does poisoning/sanitization the memory on free to reduces the attack surface.
839
840
841
842
843SL*B freelist randomization: randomizes the SLAB freelist. The list is randomized during initialization of a new set of pages. The order on different freelist sizes is pre-computed at boot for performance. Each kmem_cache has its own randomized freelist. Before pre-computed lists are available freelists are generated dynamically. This security feature reduces the predictability of the kernel SLAB allocator against heap overflows rendering attacks much less stable.
844
845
846
847
848GRKERNSEC_BRUTE: If you say Y here, attempts to bruteforce exploits against forking daemons such as apache or sshd will be deterred. When a child of a forking daemon is killed by PaX or crashes due to an illegal instruction, the parent process will be delayed 30 seconds upon every subsequent fork until the administrator is able to assess the situation and restart the daemon. It is recommended that you also enable signal logging in the auditing section so that logs are generated when a process performs an illegal instruction.
849(https://xorl.wordpress.com/2010/11/09/grkernsec_brute-exploit-bruteforcing-protection/)
850
851
852
853GRKERNSEC_PERF_HARDEN: PERF is a serious attack surface. We can’t bear it running by default in production system.
854(https://hardenedlinux.github.io/system-security/2016/12/13/kernel_mitigation_checklist.html)
855
856
857
858NOTES
8591.Using sysctl is a good way to harden the Linux kernel.
860
861
862
863
8642.Add link restrictions
865Symlinks:
866
867A long-standing class of security issues is the symlink-based
868time-of-check-time-of-use race, most commonly seen in world-writable
869directories like /tmp. The common method of exploitation of this flaw
870is to cross privilege boundaries when following a given symlink (i.e. a
871root process follows a symlink belonging to another user).
872
873The solution is to permit symlinks to only be followed when outside
874a sticky world-writable directory, or when the uid of the symlink and
875follower match, or when the directory owner matches the symlink's owner.
876
877Applications should just use mkstemp() or O_CREATE|O_EXCL.
878- True, but applications are not perfect, and new software is written
879all the time that makes these mistakes; blocking this flaw at the
880kernel is a single solution to the entire class of vulnerability.
881
882In Linux 3.6,link restrictions are enabled by default.
883
884
885
886
8873.kernel process stack overflow are rare and one of the most dangerous vulnerabilities in the kernel (gresecurity solves this with STACKLEAK and with the removal of thread_info from the kernel and GRKERNSEC_BRUTE helps PaX/Grsecurity also restricted SUID program's RLIMIT_STACK up to 8MB and the environment arg/strings up to 512KB.)
888(https://github.com/hardenedlinux/grsecurity-101-tutorials/blob/master/notes/stack_clash.md)
889
890
891
892
8934.use-after-free is a very popular bug class in kernel and it can be exploited by the adversary to gain information or priviledges. (gresecurity solves this with PAX_REFCOUNT and PAX_MEMORY_SANITIZE also helps)
894
895
896
8975.Return-to-user (ret2usr): redirects corrupted kernel pointers to data residing in user space. (gresecurity solves this with KERNEXEC,and OpenBSD's X^W also solves this )
898(https://hardenedlinux.github.io/system-security/2016/12/13/kernel_mitigation_checklist.html)
899
900
901
9026.Grsecurity kernels also disables user namespaces by default.
903
904
9057.An important technique for hardening the system is kernel address-space layout randomization (KASLR), which randomizes the placement of the kernel in the virtual address space at boot time.
906(https://lwn.net/Articles/738975/)
907
908
909
9108.Daniel Gruss's paper cites a number of hardware-based attacks on KASLR. They use techniques like exploiting timing differences in fault handling, observing the behavior of prefetch instructions, or forcing faults using the Intel TSX (transactional memory) instructions. There are rumors circulating that other such channels exist but have not yet been disclosed. In all of these cases, the processor responds differently to a memory access attempt depending on whether the target address is mapped in the page tables, regardless of whether the running process can actually access that location. These differences can be used to find where the kernel has been placed — without making the kernel aware that an attack is underway.
911
912Solution: Fixing information leaks in the hardware is difficult and, in any case, deployed systems are likely to remain vulnerable. But there is a viable defense against these information leaks: making the kernel's page tables entirely inaccessible to user space. In other words, it would seem that the practice of mapping the kernel into user space needs to end in the interest of hardening the system.
913(https://lwn.net/Articles/738975/) (https://gruss.cc/files/kaiser.pdf)
914
915
916
917
918
9199.GRKERNSEC_BRUTE disabled: 200 hrs to gain control of EIP, then ~1500 yrs to brute force the PaX's ASLR to getting root shell
920
921 GRKERNSEC_BRUTE enabled: ~1365 days to gain control of EIP, then...you don't wanna know-_-
922 (https://github.com/hardenedlinux/grsecurity-101-tutorials/blob/master/notes/stack_clash.md)
923
924
925
926
927
92810.PaX's ASLR can defeat offset2lib easily since...2001?
929(https://github.com/hardenedlinux/grsecurity-101-tutorials/blob/master/notes/stack_clash.md)
930
931
932
93311.W & X memory is the cruial condition to physmap spraying.
934(https://hardenedlinux.github.io/system-security/2016/12/13/kernel_mitigation_checklist.html)
935
936
937
93812.No unwanted driver should be compiled. No unwanted code of any kind should be compiled. All code that can reference kernel-level objects outside the kernel should be disabled.
939(https://www.quora.com/What-desktop-OS-kernel-is-the-most-hardened-the-most-unhackable)
940
941
94214.Linux kernel has been using weak entropy on stack canary for years and it has been fixed( copy+paste from PaX/Grsecurity) and merged in v4.12, while PaX/Grsecurity solved it since 2011.
943(https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git/commit/?id=5ea30e4e58040cfd6434c2f33dc3ea76e2c15b05)
944(https://hardenedlinux.github.io/system-security/2016/12/13/kernel_mitigation_checklist.html)
945--------------------------------------------------------------------------------------------------------
946OpenBSD Kernel security
947
948Trapsleds: a new mitigation that significantly reduces the amount of nops in the instruction stream, replacing them with trap instructions or jump-over-trap sequences, thereby requiring greater accuracy for targetting potential gadgets. (http://undeadly.org/cgi?action=article&sid=20170622065629)
949
950
951
952Kernel Address Randomized Link (KARL): a new "link-kit" allows the .o files of the kernel to be relinked in a random order, creating a unique kernel for each boot. /bsd is now non-readable to users, to try to keep the secret.The idea is to randomise how the kernel loads, so that kernel loading gets the same benefits as applies to (for example) application memory in ASLR (address space layout randomisation) – so an attacker can't rely on predictable memory allocations to identify where a buffer overrun might land.
953(https://www.theregister.co.uk/2017/06/19/thats_random_openbsd_adds_more_kernel_security/)
954
955
956
957accton: Process accounting is a security method in which an administrator may keep track of system resources used and their allocation among users, provide for system monitoring, and minimally track a user's commands.Process accounting has both positive and negative points. One of the positives is that an intrusion may be narrowed down to the point of entry. A negative is the amount of logs generated by process accounting, and the disk space they may require. (https://www.freebsd.org/doc/handbook/security-accounting.html) (https://man.openbsd.org/accton.8)
958
959
960
961ifstated: daemon runs commands in response to network state changes, which it determines by monitoring interface link state or running external tests. (https://man.openbsd.org/ifstated.8)
962
963
964
965pledge: restrict system operations,current process is forced into a restricted-service operating mode. A few subsets are available, roughly described as computation, memory management, read-write operations on file descriptors, opening of files, networking. In general, these modes were selected by studying the operation of many programs using libc and other such interfaces, and setting promises or execpromises. (https://man.openbsd.org/pledge.2)
966
967
968
969
970
971
972
973
974---------------------------------------------------------------------------------------------------------
975compiler security
976
977
978libc pointer encryption
979
980
981
982RANDSTRUCT:is a Grsecurity feature randomize the number of sensitive kernel structures at compile time and ported it to the mainline and merged in v4.12.
983
984
985
986
987timeless:This will cause warnings when the __TIME__, __DATE__ and __TIMESTAMP__ macros are used.
988
989
990
991-Wformat -Wformat-security:A gcc security feature while not all programs correctly implement the printf hints (like glib's G_GNUC_PRINTF macro), adding this will at least call out simple printf format string vulnerabilities. Any programs whose builds become "noisy" as a result, should be fixed anyway.
992
993
994
995-D_FORTIFY_SOURCE=2 -O1:A gcc security feature that compile-time protection against static sized buffer overflows. No known regressions or performance loss. This should be enabled system-wide.
996
997
998
999relro:During program load, several ELF memory sections need to be written to by the linker. This flags the loader to turn these sections read-only before turning over control to the program. Most notably this prevents GOT overwrite attacks.
1000
1001
1002
1003fstack-protector-strong:This is a stronger variant of stackprotector, but without significant performance penalties.This adds safety checks against stack overwrites. This renders many potential code injection attacks into aborting situations. In the best case this turns code injection vulnerabilities into denial of service or into non-issues (depending on the application).Stack Smashing Protector (SSP) *merely detects stack buffer overruns, they are not prevented.*
1004
1005
1006
1007Position Independent Executables (PIE):Position Independent Executable are needed to take advantage of Address Space Layout Randomization, supported by some kernel versions. While ASLR can already be enforced for data areas in the stack and heap (brk and mmap), the code areas must be compiled as position-independent. Shared libraries already do this (-fPIC), so they gain ASLR automatically, but binary .text regions need to be build PIE to gain ASLR. When this happens, ROP (Return Oriented Programming) attacks are
1008much harder since there are no static locations to bounce off of during a memory corruption attack.
1009
1010
1011reproducible builds:Most aspects of software verification are done on source code, as that is what humans can reasonably understand. But most of the time, computers require software to be first built into a long string of numbers to be used. With reproducible builds, multiple parties can redo this process independently and ensure they all get exactly the same result.
1012
1013
1014SANCOV:The sancov gcc plugin inserts a __sanitizer_cov_trace_pc() call at the start of basic blocks.This plugin is a helper plugin for the kcov feature. It supports all gcc versions with plugin support (from gcc-4.5 on).It is based on the gcc commit "Add fuzzing coverage support" by Dmitry Vyukov.
1015
1016
1017
1018cyclomatic_complexity:Compute cyclomatic complexity of functions based on the gcc internal representation.The cyclomatic complexity of a section of source code is the number of linearly independent paths within it. For instance, if the source code contained no control flow statements (conditionals or decision points), the complexity would be 1, since there would be only a single path through the code. If the code had one single-condition IF statement, there would be two paths through the code: one where the IF statement evaluates to TRUE and another one where it evaluates to FALSE, so the complexity would be 2. Two nested single-condition IFs, or one IF with two conditions, would produce a complexity of 3.
1019
1020
1021
1022PAX_LATENT_ENTROPY:Providing enough randomness, especially at early boot, has been a constant struggle for Linux. While on the Intel platform, Ivy Bridge and newer processor models that support RDRAND generally eliminate the problem of entropy starvation at early boot and runtime, older processors and those of other architectures continue to be plagued by this problem. The demonstrable effects of this include weak private keys on embedded systems, weak randomness on VM guests, predictable stack canaries, and more. PaX's latent entropy plugin included in grsecurity addresses the lack of randomness by modifying the instruction streams of functions called only during boot as well as some specific functions at runtime that perform some unpredictable computations from the perspective of an attacker. These functions are modified to produce a nondeterministic value based on the flow of execution. At several points in the boot process and at runtime, this pseudorandom value is mixed in to the entropy pool. Further, a kernel compiled with this plugin will have the various random pools in the kernel initialized at compile-time to random contents.(Now it’s called “latent_entropy†plugin merged in v4.9.)
1023
1024
1025
1026NOTES
10271.Issues with Stack Smashing Protector (SSP): The SSP implementation in gcc-3.x is not perfect, and can cause problems. In particular C++ code can be built incorrectly when SSP is enabled, although the exact details are not clear at the moment.The SSP implementation in gcc-4.x is completely different, even so far as changing the semantics of the compiler switches. At the time of writing, we have little experience in the SSP implementation in gcc-4.x.
1028
1029
10302.Issues with PIEs:Ideally, when building a static executable, a shared library, or building without the standard gcc system files, PIE would not be automatically enabled. Unfortunately, the options -static, -shared, -nostdlib and -nostartfiles are link options, so are usually only supplied to the link command of an executable and not to the compilation commands for individual objects. In these cases, -fPIE will be added to the compilation commands when in fact it shouldn't be. This is an unavoidable limitation, since it is impossible to know from a compilation command for an object exactly what the link command is going to be. Indeed in some cases more than one link command can happen using the same objects. Such cases have to be handled by the relevant ebuild on a case-by-case basis. The -nostdlib and -nostartfiles options occur rarely. The -shared option is usually used when the compilation commands have been performed with -fPIC, so the majority of such cases are not a problem.
1031
1032
10333.Compiler is the bridge between source code and machine code.
1034
1035
10364.The userland heap is a very significant part of an operating system, and it's not something that gets swapped out from a major operating system distribution at a whim.For those of you who don't have a programming background, let me attempt a brief and non-technical explanation of what a heap is. Basically, it's just a management facility for most of the memory that applications use. When an application (such as Mozilla, your command shell, word processor, and so on) needs some memory, it will typically take this memory from the heap. The heap is responsible for handling these requests, which involve handing out chunks of memory when requested, and freeing the chunks when the application is finished with them.
1037
1038
10395.malloc internally invokes either brk or mmap syscall.
1040
1041--------------------------------------------------------------------------------------------------------
1042hardware security
1043
1044Trusted Platform Module (TPM)
1045
1046Intel Trusted Execution Technology (TXT)
1047
1048Intel Boot Guard technology
1049
1050secure boot
1051
1052trusted boot
1053
1054coreboot
1055
1056Libreboot
1057
1058
1059
1060
1061
1062
1063NOTES:
10641.Purchase hardware from manufacturers who support GNU/Linux.
1065
1066
1067
1068
10692.Purchase hardware which supports coreboot/libreboot as a proprietary BIOS replacement.
1070
1071
1072
1073
10743.Purchase hardware without the need for proprietary drivers or firmware: hdnode.org
1075
1076
1077
1078
10794.Avoid using wireless devices, since they are insecure.
1080
1081
1082
1083
10845.Preferably disable or remove Bluetooth hardware modules.
1085
1086
1087
1088
1089
10906.Hardware-specific issues can really only be fixed at the hardware level. At best, software interventions can only provide workarounds.
1091
1092The problem is no hardware exists that consists of entirely Libre firmware. It is very difficult to: analyze the firmware of hardware, wipe potentially compromised versions, or overwrite firmware with a most-likely-clean version. If the firmware being used was Libre Software, it would make verification easier but wouldn't stop infection. Disassembling hardware components (BIOS, disk controllers, CPU, Intel AMT etc.) and flashing them with clean versions offline is so difficult, that it is just cheaper and more convenient to buy new hardware.
1093
1094
1095
1096
1097
1098
10997.Users should also avoid or disable the commonly deployed PXE boot and Wake-on-Lan (WoL) "features". PXE is implemented either as a Network Interface Card (NIC) BIOS extension or as UEFI code in modern devices (where it can be easily disabled).On most systems, WoL hardware functionality is usually blocked by default and explicitly needs to be enabled using the system BIOS or UEFI.
1100
1101--------------------------------------------------------------------------------------------------------
1102802.11 network security
1103
1104WPA2
1105
1106
1107
1108
1109NOTES
11101.protects the data messages by generating perpacket keys. Although no security solution can claim to be “bullet-proof,†WPA represents a quantum leap forward in Wi-Fi security.Although recently, Mathy Vanhoef of imec-DistriNet, KU Leuven, discovered a serious weakness in WPA2 known as the Key Reinstallation AttaCK (or KRACK) attack. Their overview, Key Reinstallation Attacks: Breaking WPA2 by forcing nonce reuse, and research paper (Key Reinstallation Attacks: Forcing Nonce Reuse in WPA2, co-authored by Frank Piessens) have created quite a stir in our industry because the press touts that it “breaks Wi-Fiâ€.
1111
11122.Disable Wi-Fi Protected Setup (WPS) because it allows any device to connect to the network with the relevant eight-digit PIN.
1113
11143.Do not bother disabling SSID broadcasting since it is trivial to guess.
1115
11164.Do not rely on the WEP and WPA standards which are cryptographically weak and have known security weaknesses. Use the WPA2 standard so only authorized users can use the network.
1117
11185.Use routers that exclusively use WPA2, preferably with the AES standard (CCMP) and not TKIP which is less secure.
1119
11206.Enable the "Block WAN Requests" option to conceal the network from other Internet users.
1121
11227.Limit the number of Dynamic Host Configuration Protocol (DHCP) leases (connects) to the Wi-Fi network to match the number of personal devices owned.
1123
11248.If you must allow use of the Wi-Fi network to visitors, set up a guest network that turns itself off after a set period.
1125
11269.Use the 5-GHz band for Wi-Fi instead of the standard 2.4GHz band (if possible), since the 5 GHz band does not travel as far.
1127
112810.If possible, schedule Wi-Fi networks to turn off at night, and then turn on in the morning.
1129
113011.If possible, use a dedicated network connection (LAN, WiFi etc.) that is not shared with other potentially compromised computers.
1131
113212.If using a shared network via a common cable modem/router or ADSL router, configure a de-militarized zone (perimeter network) to restrict Whonix-Gateway accessibility to/from other nodes on the network e.g. printers, phones and laptops.
1133
113413.A novel approach to counter the replay and fake CTS frame injection DoS attacks caused by not securing the 802.11 control frames is proposed. The solution to improve the current 802.11 control frame protection by generating a unique message authentication code using IAPP framework for key distribution and key management is proposed. SHA-2 or 3, the cryptographic hash function which is used to generate MAC for the control frames is supported by most of the current wireless station adapters which in turn makes this approach very cost effective.
1135
1136
1137--------------------------------------------------------------------------------------------------------
1138Router security
1139
1140Openwrt
1141
1142pfsense
1143
1144
1145
1146
1147NOTES
11481.Users should consider upgrading to a commercial-grade router that is normally intended for small businesses as a sensible investment in security. Further, it is safer to have a personally owned routing device that connects to an ISP-provided modem/router in order to maximize administrative control over routing and wireless features of the home network.
1149
11502.Change the default router username and password to something suitably long and random.
1151
11523.Turn off Universal Plug and Play (UPnP), which can allow applications to open ports to external computers.
1153
11544.Disable NAT-PMP, since it has similar functionality to UPnP.
1155
11565.Disable the Home Network Administrative Protocol since it allows remote management of network devices.
1157
11586.Port forwarding (if desired by the user) should be limited to a source IP address and/or source IP address subnet.
1159
11607.Keep router firmware up-to-date at all times for better security. Set the self-updating firmware option if it is available.
1161
11628.Do not bind services to the external interface.
1163
11649.Reconfigure the router firewall rules to drop all relevant incoming packets.
1165
116610.Disable the HTTP interface and enable the HTTPS interface instead, preferably on a non-standard port. For example: https://192.168.1.1:82 instead of http://192.168.1.1
1167
116811.Use the browser's incognito or private mode when accessing the administrative interface so the URL is not saved in the browser history.
1169
117012.Change the Service Set ID (SSID) which often leaks router information. Do not use personally identifying information like the apartment number you live in.
1171
117213.Disable cloud-based router management (if offered) because trust is shifted to another person between the user and the router.
1173
117414.Do not use mesh router systems that do not permit local administrative access.
1175
117615.Disable remote administrative access and administrative access over Wi-Fi. Set administrator access only via wired ethernet connections (not possible with mesh routers).
1177
117816.Disable all other remote-access protocols like PING, Telnet and SSH.
1179
118017.Firewall ports should be set to "stealth" rather than "closed" so no response is given to unsolicited external communications from attackers probing the network.
1181
118218.Set logging to on, if the feature is available. This allows for a record of unsolicited incoming connection attempts, attempted logins and so on.
1183
118419.Avoid administrating the router with a smartphone application.
1185
118620.Use Gibson Research Corp.'s Shields Up port-scanning service to test the router for hundreds of common vulnerabilities, most of which can be mitigated by the router's administrator.
1187
118821.If possible, use a dedicated network connection (LAN, WiFi etc.) that is not shared with other potentially compromised computers.
1189
119022.If using a shared network via a common cable modem/router or ADSL router, configure a de-militarized zone (perimeter network) to restrict Whonix-Gateway accessibility to/from other nodes on the network e.g. printers, phones and laptops.
1191
119223.WiFi users should default to the WPA2-AES standard which provides the safest protocol and strongest encryption currently.
1193
119424.Do not rely on WiFi Protected Set-up (WPS), which has major security flaws.
1195--------------------------------------------------------------------------------------------------------
1196vulnerability scanners
1197
1198OpenVAS : created by Greenbone Networks,framework of several services and tools offering a comprehensive and powerful vulnerability scanning and vulnerability management solution.
1199
1200
1201Vega: created by subgraph,security scanner and web security testing platform to test the security of web applications.
1202
1203
1204Qualys FreeScan (network vulnerablity scanner):
1205--------------------------------------------------------------------------------------------------------
1206secure Microkernels
1207
1208
1209SeL4
1210
1211
1212
1213
1214--------------------------------------------------------------------------------------------------------
1215security by isolation programs
1216
1217Oz:Uses kernal namespaces for isolation.
1218
1219
1220
1221
1222
1223Firejail (SUID program) : Firejail is an easy to use and simple tool for sandboxing applications and servers alike. Firejail is suggested for browsers and internet facing applications, as well as any servers you may be running. Firejail is further enhanced when used with Grsecurity.
1224
1225
1226
1227
1228
1229XEN : Is a type 1 hypervisor,use more full virtualization options such as Xen can also improve security in the event you plan on running risky applications or browsing dangerous websites,can be used for VM isolation.
1230
1231
1232
1233
1234
1235virtualbox : Type 2 Hypervisor,can be used for VM isolation.
1236
1237
1238
1239
1240sandboxie
1241
1242
1243
1244
1245chroots: Manual chroot jails can also be constructed.
1246
1247
1248
1249
1250bubblewrap:is a setuid sandbox application developed from Flatpak with an even smaller resource footprint than Firejail. While it lacks certain features such as file path whitelisting, bubblewrap does offer bind mounts as well as the creation of user/IPC/PID/network/cgroup namespaces and can support both simple and complex sandboxes.
1251
1252-------------------------------------------------------------------------------------------------------
1253network intrusion prevention system (NIPS) and network intrusion detection system (NIDS)
1254
1255
1256Bro IDS: Bro comes with analyzers for many protocols, enabling high-level semantic analysis at the application layer.Bro-IDS is a bit different than Snort.In a way Bro is both a signature and anomaly-based IDS. Its analysis engine will convert traffic captured into a series of events. An event could be a user logon to FTP, a connection to a website or practically anything. The power of the system is what comes after the event engine and that's the Policy Script Interpreter. This policy engine has it's own language ( Bro-Script ) and it can do some very powerful and versatile tasks.If you're an analyst and you've wondered "How can I automate some of my work?" then this is the tool you've been looking for.
1257
1258
1259
1260Snort: de-facto standard for IDS and eventually IPS (thanks to community effort!)
1261
1262
1263
1264AlienVault OSSIM (Open Source Security Information Management): integrating a selection of tools designed to aid network administrators in computer security, intrusion detection and prevention.Intended to give security analysts and administrators a view of all the security-related aspects of their system, by combining log management and asset management and discovery with information from dedicated information security controls and detection systems.OSSIM performs these functions using other well-known open-source software security components, unifying them under a single browser-based user interface. OSSIM comes with PRADS,OpenVAS,Snort,Suricata,Tcptrack,Nagios,OSSEC,Munin,NFSen/NFDump,FProbe,OSSIM also includes self developed tools, the most important being a generic correlation engine with logical directive support and logs integration with plugins.Note: Suricata and Snort cannot be used at the same time. Snort is currently being phased out in favor of Suricata. (https://en.wikipedia.org/wiki/OSSIM)
1265
1266
1267
1268
1269
1270NOTES
1271There are a number of techniques which attackers are using, the following are considered 'simple' measures which can be taken to evade IDS:
1272
1273
12741.Fragmentation: by sending fragmented packets, the attacker will be under the radar and can easily bypass the detection system's ability to detect the attack signature.
1275
1276
12772.Avoiding defaults: The TCP port utilised by a protocol does not always provide an indication to the protocol which is being transported. For example, an IDS may expect to detect a trojan on port 12345. If an attacker had reconfigured it to use a different port the IDS may not be able to detect the presence of the trojan.
1278
1279
12803.Coordinated, low-bandwidth attacks: coordinating a scan among numerous attackers (or agents) and allocating different ports or hosts to different attackers makes it difficult for the IDS to correlate the captured packets and deduce that a network scan is in progress.
1281
1282
12834.Address spoofing/proxying: attackers can increase the difficulty of the ability of Security Administrators to determine the source of the attack by using poorly secured or incorrectly configured proxy servers to bounce an attack. If the source is spoofed and bounced by a server then it makes it very difficult for IDS to detect the origin of the attack.
1284
1285
12865.Pattern change evasion: IDSs generally rely on 'pattern matching' to detect an attack. By changing the data used in the attack slightly, it may be possible to evade detection. For example, an Internet Message Access Protocol (IMAP) server may be vulnerable to a buffer overflow, and an IDS is able to detect the attack signature of 10 common attack tools. By modifying the payload sent by the tool, so that it does not resemble the data that the IDS expects, it may be possible to evade detection.
1287--------------------------------------------------------------------------------------------------------
1288host-based intrusion detection system (HIDS)
1289
1290OSSEC
1291--------------------------------------------------------------------------------------------------------
1292packet analyzers
1293
1294
1295packet total (PacketTotal is a free, online PCAP analyzer designed to visualize network traffic, detect malware, and provide analytics for the traffic contained within.) ( https://packettotal.com/ )
1296
1297
1298
1299tcpdump: a powerful command-line packet analyzer. (http://www.tcpdump.org/)
1300
1301-------------------------------------------------------------------------------------------------------
1302network analysis scanners
1303
1304
1305Wireshark: is network protocol analyzer,it lets you see what’s happening on your network at a microscopic level and is the de facto (and often de jure) standard across many commercial and non-profit enterprises, government agencies, and educational institutions.(https://www.wireshark.org/)
1306
1307
1308Nmap: utility for network discovery and security auditing. Many systems and network administrators also find it useful for tasks such as network inventory, managing service upgrade schedules, and monitoring host or service uptime. (https://nmap.org/)
1309
1310-------------------------------------------------------------------------------------------------------
1311disk encryption
1312
1313
1314Linux Unified Key Setup (LUKS): encrypts storage media volumes.
1315(http://www.forensicswiki.org/wiki/Linux_Unified_Key_Setup_(LUKS) )
1316
1317
1318
1319notes
1320
1321
13221.Question:If I stick to standard operations, and I do not require any of the features from LUKS, what risks am I as a non-expert taking?
1323
1324LUKS partitions have a header that ensures such a partition won't be seen as ext2, vfat, etc. A plain dm-crypt partition may coincidentally end up looking like a unencrypted filesystem, and has a chance of being written to accidentally, destroying your data.
1325
1326LUKS checks if you entered the correct passphrase. If you put in the wrong passphrase, plain dm-crypt won't pick up on this; instead, it will happily give you garbled crypto-mapping which may also coincidentally look like an unencrypted filesystem, and has a chance of being written to accidentally, destroying your data.
1327
1328LUKS stores the type of encryption used, while dm-crypt requires you to supply the same options each time. If, after a period of not using your encrypted device, you find there are a few gaps in your recollection of what the password was, and it turns out you forgot the encryption options as well, you are doubly hosed (this happened to me personally before LUKS existed; the encrypted data wasn't so important so I just reformatted after unsuccessfully trying to get in for an hour or so).
1329(https://security.stackexchange.com/questions/90468/why-is-plain-dm-crypt-only-recommended-for-experts)
1330
1331-------------------------------------------------------------------------------------------------------
1332security audit tools
1333
1334
1335Lynis: Security auditing tool for Linux, macOS, and UNIX-based systems. Assists with compliance testing (HIPAA/ISO27001/PCI DSS) and system hardening. (https://cisofy.com/lynis/)
1336
1337
1338
1339TIGER: The Unix security audit and host intrusion detection tool. (http://www.nongnu.org/tiger/)
1340
1341
1342
1343Scout2: Security auditing tool for AWS environments. (https://nccgroup.github.io/Scout2/)
1344
1345
1346
1347prowler: Tool for AWS security assessment, auditing and hardening. It follows guidelines of the CIS Amazon Web Services Foundations Benchmark. (https://d0.awsstatic.com/whitepapers/compliance/AWS_CIS_Foundations_Benchmark.pdf)
1348
1349
1350
1351lunar: A UNIX security auditing tool based on several security frameworks. (https://github.com/lateralblast/lunar)
1352
1353-------------------------------------------------------------------------------------------------------
1354Network and applications layer authentication and encryption methods (some may support combinations of authentication, integrity, access control, and confidentiality).
1355
1356Quantum cryptography
1357
1358
1359
1360SHA3-512 (based off Secure Hash Algorithm 3)
1361
1362
1363
1364Elliptic curve cryptography (ECC) (using:Ed25519 and Curve25519)
1365
1366
1367
1368Kerberos
1369
1370
1371
1372IP Security Protocol (IPSec)
1373
1374
1375
1376AES-256 (with PKCS7 padding)
1377
1378
1379
1380RSA (using 4096 bit)
1381
1382
1383
1384GNU Privacy Guard (GPG) (based off PGP)
1385
1386
1387
1388Secure Shell (SSH)
1389
1390
1391
1392Transport Layer Security (TLS)
1393
1394
1395
1396
1397NOTES
13981.IPsec is an end-to-end security scheme operating in the Internet Layer of the Internet Protocol Suite, while some other Internet security systems in widespread use, such as Transport Layer Security (TLS) and Secure Shell (SSH), operate in the upper layers at the Transport Layer (TLS) and the Application layer (SSH). Hence, only IPsec protects all application traffic over an IP network. IPsec can automatically secure applications at the IP layer.
1399
1400
1401
14022.IPSec controls whether a user can connect to the computer at the IP layer, not the application layer.
1403
1404
1405
14063.For confidentiality, PGP encrypts messages with an efficient single-key or conventional encryption algorithm known as IDEA. It then uses RSA to encrypt, with the receiver's public key, the IDEA key used to encrypt the message. The receiver can use RSA to recover the IDEA key and use that key to recover the message.
1407
1408
1409
1410
14114.What do Digital Signatures Prove and What They DO NOT Prove:
1412
1413Digital Signatures show that someone who had access to the private key has made a signature. It is an indication, that its contents have not been tampered (so, integrity is preserved) and can indicate, that a given file is authentic.Digital Signatures do not prove any other property, e.g. that the file is not malicious. In fact there is nothing that could stop people from signing a malicious program.
1414
1415The point is, of course, that people need to choose to trust some people, e.g. Linus Torvalds, Microsoft, etc. and assume that if a file(s) was indeed signed by those individuals, then indeed it should not be malicious and buggy in some horrible way. But the decision of whether to trust certain people is beyond the scope of digital signatures.
1416
1417
1418
1419
14205.IP Security Protocol (IPSec), which the operating systems uses rather than relying on the inherently insecure TCP/IP Version 4 (IPV4). (IPV4 chooses to trust just about everybody and everything.) IPSec encrypts and validates packets to protect the privacy of data and to ensure that no changes are made to packets during the delivery process. IPSec became an integral piece of the standard Internet Protocol with the introduction of TCP/IP Version 6 (IPV6), making the future of the Internet more secure by default.
1421
1422
14236.SSL should be done using LibreSSL or a trusted independent version.
1424(https://www.quora.com/What-desktop-OS-kernel-is-the-most-hardened-the-most-unhackable)
1425
1426
1427
14287.entropy is the randomness collected by an operating system or application for use in cryptography or other uses that require random data.
1429
1430Basically, when you’re generating keys (let’s say RSA 2048) you need true random numbers. You don’t want them to be deterministic (based on a timestamp or some vague ID): cryptography relies on good randomness.
1431For example, when you boot up a computer, how can this randomness be different from any other computer? This is especially a big issue for IoT devices (routers) with very few sources of entropy — and yet they (sometimes) have to generate keys at boot-time! Resulting in hosts sharing the same keys due to bad randomness.
1432(https://blog.0day.rocks/introducing-the-first-ever-shitpost-based-rng-c5422bfce257)
1433
1434
14358.60% of HTTPS and SSH hosts served non-unique public keys.
1436(http://web.stanford.edu/class/ee380/Abstracts/150513-slides.pdf)
1437
1438
14399.How can we add entropy on Linux?
1440One basic trick is to move your mouse and type random things on your keyboard. The Linux kernel will automatically add these inputs as entropy bits. But one cannot do that all day long, right?
1441(https://blog.0day.rocks/introducing-the-first-ever-shitpost-based-rng-c5422bfce257)
1442
1443-------------------------------------------------------------------------------------------------------
1444Executable space protections
1445
1446Data Execution Prevention (DEP)
1447
1448W^X
1449
1450
1451
1452notes
1453
14541.Bypassing DEP and NX requires a cool trick called Return-Oriented Programming.
1455
1456-------------------------------------------------------------------------------------------------------
1457server security suite
1458
1459Atomic Secured Linux
1460
1461
1462
1463-------------------------------------------------------------------------------------------------------
1464VPNS
1465
1466
1467ipvanish (No Logs, Best For Tor, DNS Leak Protection, Unlimited Bandwidth)
1468
1469
1470
1471ExpressVPN (AES-256 cipher with RSA-4096 handshake and SHA-512 HMAC, Elliptic Curve Diffie–Hellman, fast, DNS leak protection, kill switch, no logs)
1472
1473
1474Torguard (Blocks WebRTC/DNS/IPv6 Leaks, 3000+ Servers in 50+ Countries, AES-256, TLS, IPsec, Advertisement and Malware Blocking, DPI Bypass, OpenVPN, IKev2, AnyConnect & OpenConnect SSL based VPN, Unlimited Bandwidth, no logs)
1475
1476
1477Riseup VPN (bitmask)
1478
1479
1480iVPN (Unlimited Bandwidth, Multihop Technology, no logs , kill switch, firewall-based DNS leak protection, WebRTC leak, fast, Servers in 12 countries, Up to three simultaneous connections,more available on request, OpenVPN and L2TP/IPsec VPN protocols, Obfsproxy, AES-256 cipher with RSA-4096 handshake and HMAC SHA-1 hash authentication, Diffie-Hellman exchange (DHE) introduces perfect forward secrecy PFS), with a new encryption key generated every hour)
1481
1482
1483OpenVPN (DPI Bypass,AES-256,based on open source software,Challenge/Response authentication,possible to execute scripts in the context of the desktop user instead of the root context of the OpenVPN daemon, Web-free VPN,Local subnet blocking)
1484
1485
1486
1487NOTES
14881.You -> VPN -> Tor
1489
1490You can very well decrease your anonymity by using VPN/SSH in addition to Tor.If you know what you are doing you can increase anonymity, security and privacy.
1491
1492Most VPN/SSH provider log, there is a money trail, if you can't pay really anonymously. (An adversary is always going to probe the weakest link first...). A VPN/SSH acts either as a permanent entry or as a permanent exit node. This can introduce new risks while solving others.
1493
1494Who's your adversary? Against a global adversary with unlimited resources more hops make passive attacks (slightly) harder but active attacks easier as you are providing more attack surface and send out more data that can be used. Against colluding Tor nodes you are safer, against blackhat hackers who target Tor client code you are safer (especially if Tor and VPN run on two different systems). If the VPN/SSH server is adversary controlled you weaken the protection provided by Tor. If the server is trustworthy you can increase the anonymity and/or privacy (depending on set up) provided by Tor.
1495
1496VPN/SSH can also be used to circumvent Tor censorship (on your end by the ISP or on the service end by blocking known tor exits).
1497
1498
1499
1500
15012.Do not use a VPN as an anonymity solution. If you're looking for a trusted entry into the Tor network, or if you want to obscure the fact that you're using Tor, setting up a private server as a bridge works quite well.
1502
1503VPNs encrypt the traffic between the user and the VPN provider, and they can act as a proxy between a user and an online destination. However, VPNs have a single point of failure: the VPN provider. A technically proficient attacker or a number of employees could retrieve the full identity information associated with a VPN user. It is also possible to use coercion or other means to convince a VPN provider to reveal their users' identities.
1504
1505
1506
15073.Is it possible to completely disable logging?The command «log/dev/null» on Linux completely removes all the logs of OpenVPN service. Owing to the settings, you can completely disable the logging of any connections to the OpenVPN server.
1508
1509
1510
15114.Multihop Technology:This basically allows you to “chain†VPN servers, so that your data is routed between two VPN servers as it travels between you and the internet.
1512
1513
1514--------------------------------------------------------------------------------------------------------
1515proxies
1516
15171.Privoxy: is a proxy server that (pay attention here) uses application-layer filtering. HTTP traffic passed through Privoxy will have certain privacy-oriented rules applied to them. For example, Privoxy will block ads, detect and disable click-tracking scripts, disabling pop-ups, etc.
1518
1519
1520--------------------------------------------------------------------------------------------------------
1521distributing files or data anonymously
1522
1523secure drop
1524
1525OnionShare
1526--------------------------------------------------------------------------------------------------------
1527scan websites automatically for common vulnerabilities and errors that can de-anonymize the owner or users
1528
1529OnionScan
1530--------------------------------------------------------------------------------------------------------
1531easiest way to add an onion address to a traditional websites
1532
1533Enterprise Onion Toolkit (EOTK): adds an onion address to a traditional website
1534
1535-------------------------------------------------------------------------------------------------------
1536proof that bugs can go undetected for atleast 1 year or more!
1537
1538
15391.Orpheus' Lyre:In 2017 Two implementations of the Kerberos authentication protocol received patches this week against a vulnerability that allowed a threat actor to bypass authentication procedures.The vulnerability was discovered by a team of three researchers, who dubbed it "Orpheus' Lyre." Researchers tracked down the flaw to Kerberos versions released in 1996.Orpheus' Lyre exploits a part of the Kerberos protocol named "tickets." These are messages exchanged between network nodes, and are used to authenticate services and users.Not all parts of a ticket are encrypted when sent through the network. Kerberos implementations usually rely on checking the encrypted parts of a Kerberos message to authenticate users and services.Researchers said they found a way to force the Kerberos protocol to use the plaintext and non-encrypted part for authentication procedures.
1540
1541
15422.Dirty COW:is a computer security vulnerability for the Linux kernel that affects all Linux-based operating systems It is a local privilege escalation bug that exploits a race condition in the implementation of the copy-on-write mechanism in the kernel's memory-management subsystem.Because of the race condition, with the right timing, a local attacker can exploit the copy-on-write mechanism to turn a read-only mapping of a file into a writable mapping. Although it is a local privilege escalation, remote attackers can use it in conjunction with other exploits that allow remote execution of non-privileged code to achieve remote root access on a computer.The attack itself does not leave traces in the system log! The vulnerability has existed in the Linux kernel since version 2.6.22 released in September 2007, and there is information about it being actively exploited at least since October 2016.
1543
1544
15453.Heartbleed:is a security bug in the OpenSSL cryptography library, which is a widely used implementation of the Transport Layer Security (TLS) protocol. It was introduced into the software in 2012 and publicly disclosed in April 2014. Heartbleed may be exploited regardless of whether the vulnerable OpenSSL instance is running as a TLS server or client. It results from improper input validation (due to a missing bounds check) in the implementation of the TLS heartbeat extension, thus the bug's name derives from heartbeat. The vulnerability is classified as a buffer over-read, a situation where more data can be read than should be allowed.
1546
1547
15484.POODLE:which stands for "Padding Oracle On Downgraded Legacy Encryption",is a man-in-the-middle exploit which takes advantage of Internet and security software clients' fallback to SSL 3.0.If attackers successfully exploit this vulnerability, on average, they only need to make 256 SSL 3.0 requests to reveal one byte of encrypted messages.POODLE exemplifies a vulnerability that succeeds thanks to a mechanism designed for reducing security for the sake of interoperability. When designing systems in domains with high levels of fragmentation, then, extra care is appropriate. In such domains graceful security degradation may become common. (SSL version 3.0 was released in 1996,so potentially this bug can be as old as 1996!)
1549
1550
15515.Shellshock:also known as Bashdoor,is a family of security bugs in the widely used Unix Bash shell, the first of which was disclosed on 24 September 2014. Many Internet-facing services, such as some web server deployments, use Bash to process certain requests, allowing an attacker to cause vulnerable versions of Bash to execute arbitrary commands. This can allow an attacker to gain unauthorized access to a computer system.The first bug causes Bash to unintentionally execute commands when the commands are concatenated to the end of function definitions stored in the values of environment variables.Within days of the publication of this, intense scrutiny of the underlying design flaws discovered a variety of related vulnerabilities (CVE-2014-6277, CVE-2014-6278, CVE-2014-7169, CVE-2014-7186, and CVE-2014-7187); which Ramey addressed with a series of further patches.Analysis of the source code history of Bash shows the bugs had existed since Bash version 1.03 released in September 1989!
1552
1553
15546.VENOM(Virtualized Environment Neglected Operations Manipulation ): is a security vulnerability in the virtual floppy drive code used by many computer virtualization platforms. This vulnerability may allow an attacker to escape from the confines of an affected virtual machine (VM) guest and potentially obtain code-execution access to the host. Absent mitigation, this VM escape could open access to the host system and all other VMs running on that host, potentially giving adversaries significant elevated access to the host’s local network and adjacent systems.The VENOM bug has existed since 2004, though it has reportedly not been exploited in the wild yet.
1555
1556
1557
1558
15597.Meltdown: breaks the most fundamental isolation between user applications and the operating system. This attack allows a program to access the memory, and thus also the secrets, of other programs and the operating system.If your computer has a vulnerable processor and runs an unpatched operating system, it is not safe to work with sensitive information without the chance of leaking the information. This applies both to personal computers as well as cloud infrastructure.There are patches against Meltdown for Linux, Windows, and OS X.Meltdown has potentially existed since 1995.
1560(https://meltdownattack.com/) (https://lwn.net/Articles/738975/)
1561
1562
1563
1564
15658.Spectre: breaks the isolation between different applications. It allows an attacker to trick error-free programs, which follow best practices, into leaking their secrets. In fact, the safety checks of said best practices actually increase the attack surface and may make applications more susceptible to Spectre.Spectre is harder to exploit than Meltdown, but it is also harder to mitigate.However, it is possible to prevent specific known exploits based on Spectre through software patches.Spectre has potentially existed since 1995.
1566(https://meltdownattack.com/) (http://lists.llvm.org/pipermail/llvm-commits/Week-of-Mon-20180101/513630.html)
1567
1568
1569
1570
1571
1572--------------------------------------------------------------------------------------------------------
1573protection against Cross-Site Request Forgery (CSRF)
1574
1575We recommend two separate checks as your standard CSRF defense that does not require user intervention. This discussion ignores for the moment deliberately allowed cross origin requests (e.g., CORS). Your defenses will have to adjust for that if that is allowed.
1576
1577
15781.Check standard headers to verify the request is same origin
1579
15802.AND Check CSRF token
1581
1582(for a full explanation go here: https://www.owasp.org/index.php/Cross-Site_Request_Forgery_(CSRF)_Prevention_Cheat_Sheet )
1583
1584
1585
1586--------------------------------------------------------------------------------------------------------
1587Preventing Remote File Inclusion (RFI) Attacks
1588
1589
15901.Never use arbitrary input data in a literal file include request.
1591
1592
15932.Use a filter to thoroughly scrub input parameters against possible file inclusions.
1594
1595
15963.Build a dynamic whitelist.
1597
1598
1599NOTES
16001.The RFI is a cousin to the nefarious XSS cross-site scripting attack. Both are forms of code injection, although the RFI is less sophisticated. As such, it is also more easily prevented.
1601
1602
16032.Like all code injection attacks, RFI is a result of allowing unsecure data into a secure context. The best way to prevent an RFI attack is to never use arbitrary input data in a literal file include request.
1604
1605
1606(for a full explanation go here: http://www.esecurityplanet.com/browser-security/how-to-prevent-remote-file-inclusion-rfi-attacks.html )
1607--------------------------------------------------------------------------------------------------------
1608cross site scripting (XSS) prevention
1609
16101.HTML Escape Before Inserting Untrusted Data into HTML Element Content
1611
1612
1613
16142.Attribute Escape Before Inserting Untrusted Data into HTML Common Attributes
1615
1616
1617
16183.JavaScript Escape Before Inserting Untrusted Data into JavaScript Data Values
1619
1620
1621
16224.HTML escape JSON values in an HTML context and read the data with JSON.parse
1623
1624
1625
16265.CSS Escape And Strictly Validate Before Inserting Untrusted Data into HTML Style Property Values
1627
1628
1629
16306.URL Escape Before Inserting Untrusted Data into HTML URL Parameter Values
1631
1632
1633
1634
16357.Prevent DOM-based XSS
1636
1637
1638
1639
16408.Use HTTPOnly cookie flag
1641
1642Preventing all XSS flaws in an application is hard, as you can see. To help mitigate the impact of an XSS flaw on your site, OWASP also recommends you set the HTTPOnly flag on your session cookie and any custom cookies you have that are not accessed by any Javascript you wrote. This cookie flag is typically on by default in .NET apps, but in other languages you have to set it manually.
1643
1644
1645
1646
16479.Implement Content Security Policy
1648
1649There is another good complex solution to mitigate the impact of an XSS flaw called Content Security Policy. It's a browser side mechanism which allows you to create source whitelists for client side resources of your web application, e.g. JavaScript, CSS, images, etc. CSP via special HTTP header instructs the browser to only execute or render resources from those sources.
1650
1651
1652
165310.Use an Auto-Escaping Template System
1654
1655Many web application frameworks provide automatic contextual escaping functionality such as AngularJS strict contextual escaping and Go Templates. Use these technologies when you can.
1656
1657
1658
165911.Use the X-XSS-Protection Response Header
1660
1661This HTTP response header enables the Cross-site scripting (XSS) filter built into some modern web browsers. This header is usually enabled by default anyway, so the role of this header is to re-enable the filter for this particular website if it was disabled by the user.
1662
1663
1664(for a full explanation go here: https://www.owasp.org/index.php/XSS_(Cross_Site_Scripting)_Prevention_Cheat_Sheet )
1665--------------------------------------------------------------------------------------------------------
1666defenses against SQL injections
1667
1668Defense Option 1: Prepared Statements (with Parameterized Queries)
1669
1670The use of prepared statements with variable binding (aka parameterized queries) is how all developers should first be taught how to write database queries. They are simple to write, and easier to understand than dynamic queries. Parameterized queries force the developer to first define all the SQL code, and then pass in each parameter to the query later. This coding style allows the database to distinguish between code and data, regardless of what user input is supplied.
1671
1672Prepared statements ensure that an attacker is not able to change the intent of a query, even if SQL commands are inserted by an attacker. In the safe example below, if an attacker were to enter the userID of tom' or '1'='1, the parameterized query would not be vulnerable and would instead look for a username which literally matched the entire string tom' or '1'='1.
1673
1674
1675
1676
1677
1678
1679
1680
1681Defense Option 2: Stored Procedures
1682
1683Stored procedures are not always safe from SQL injection. However, certain standard stored procedure programming constructs have the same effect as the use of parameterized queries when implemented safely* which is the norm for most stored procedure languages. They require the developer to just build SQL statements with parameters which are automatically parameterized unless the developer does something largely out of the norm. The difference between prepared statements and stored procedures is that the SQL code for a stored procedure is defined and stored in the database itself, and then called from the application. Both of these techniques have the same effectiveness in preventing SQL injection so your organization should choose which approach makes the most sense for you.
1684
1685
1686
1687
1688
1689
1690Defense Option 3: White List Input Validation
1691
1692Various parts of SQL queries aren't legal locations for the use of bind variables, such as the names of tables or columns, and the sort order indicator (ASC or DESC). In such situations, input validation or query redesign is the most appropriate defense. For the names of tables or columns, ideally those values come from the code, and not from user parameters. But if user parameter values are used to make different for table names and column names, then the parameter values should be mapped to the legal/expected table or column names to make sure unvalidated user input doesn't end up in the query. Please note, this is a symptom of poor design and a full re-write should be considered if time allows.
1693
1694
1695
1696
1697
1698
1699
1700Defense Option 4: Escaping All User Supplied Input
1701
1702This technique should only be used as a last resort, when none of the above are feasible. Input validation is probably a better choice as this methodology is frail compared to other defenses and we cannot guarantee it will prevent all SQL Injection in all situations.
1703
1704This technique is to escape user input before putting it in a query. It is very database specific in its implementation. Its usually only recommended to retrofit legacy code when implementing input validation isn't cost effective. Applications built from scratch, or applications requiring low risk tolerance should be built or re-written using parameterized queries, stored procedures, or some kind of Object Relational Mapper (ORM) that builds your queries for you.
1705
1706This technique works like this. Each DBMS supports one or more character escaping schemes specific to certain kinds of queries. If you then escape all user supplied input using the proper escaping scheme for the database you are using, the DBMS will not confuse that input with SQL code written by the developer, thus avoiding any possible SQL injection vulnerabilities.
1707
1708
1709
1710Additional Defenses
1711
1712To minimize the potential damage of a successful SQL injection attack, you should minimize the privileges assigned to every database account in your environment. Do not assign DBA or admin type access rights to your application accounts. We understand that this is easy, and everything just ‘works’ when you do it this way, but it is very dangerous. Start from the ground up to determine what access rights your application accounts require, rather than trying to figure out what access rights you need to take away. Make sure that accounts that only need read access are only granted read access to the tables they need access to. If an account only needs access to portions of a table, consider creating a view that limits access to that portion of the data and assigning the account access to the view instead, rather than the underlying table. Rarely, if ever, grant create or delete access to database accounts.
1713
1714If you adopt a policy where you use stored procedures everywhere, and don’t allow application accounts to directly execute their own queries, then restrict those accounts to only be able to execute the stored procedures they need. Don’t grant them any rights directly to the tables in the database.
1715
1716SQL injection is not the only threat to your database data. Attackers can simply change the parameter values from one of the legal values they are presented with, to a value that is unauthorized for them, but the application itself might be authorized to access. As such, minimizing the privileges granted to your application will reduce the likelihood of such unauthorized access attempts, even when an attacker is not trying to use SQL injection as part of their exploit.
1717
1718While you are at it, you should minimize the privileges of the operating system account that the DBMS runs under. Don't run your DBMS as root or system! Most DBMSs run out of the box with a very powerful system account. For example, MySQL runs as system on Windows by default! Change the DBMS's OS account to something more appropriate, with restricted privileges.
1719
1720
1721
1722(for a full explanation go here: https://www.owasp.org/index.php/SQL_Injection_Prevention_Cheat_Sheet )
1723--------------------------------------------------------------------------------------------------------
1724XPath Injection Defenses
1725
17261.Just like the techniques to avoid SQL injection, you need to use a parameterized XPath interface if one is available, or escape the user input to make it safe to include in a dynamically constructed query. If you are using quotes to terminate untrusted input in a dynamically constructed XPath query, then you need to escape that quote in the untrusted input to ensure the untrusted data can't try to break out of that quoted context.
1727
17282.Another better mitigation option is to use a precompiled XPath query. Precompiled XPath queries are already preset before the program executes, rather than created on the fly after the user's input has been added to the string. This is a better route because you don't have to worry about missing a character that should have been escaped.
1729
1730
1731
1732--------------------------------------------------------------------------------------------------------
1733problems that have not been solved yet
1734
17351.there has been no solution proposed to protect the network from DoS attacks caused by an attacker using CTS-to-Self.
1736
1737(CTS=Clear To Send)
1738
1739
1740
1741
1742
1743
1744
17452.Tor is vulnerable to statistical "traffic confirmation" attacks, where the adversary watches traffic at both ends of a circuit and confirms his guess that they're communicating. It would be really nice if we could use cover traffic to confuse this attack. But there are three problems here:
1746
1747.Cover traffic is really expensive. And *every* user needs to be doing it. This adds up to a lot of extra bandwidth cost for our volunteer operators, and they're already pushed to the limit.
1748
1749.You'd need to always be sending traffic, meaning you'd need to always be online. Otherwise, you'd need to be sending end-to-end cover traffic -- not just to the first hop, but all the way to your final destination -- to prevent the adversary from correlating presence of traffic at the destination to times when you're online. What does it mean to send cover traffic to -- and from -- a web server? That is not supported in most protocols.
1750
1751.Even if you *could* send full end-to-end padding between all users and all destinations all the time, you're *still* vulnerable to active attacks that block the padding for a short time at one end and look for patterns later in the path.
1752
1753
1754
1755
1756
1757
17583.We’ve been losing software freedom because ME, which is the most powerful demon from Ring -3 world. Since it’s more likely an invincible enemy even Intel haven’t disable SPI by adding a similar feature into the same physical package of processor( because it’d be harmful to OEM’s interest?)
1759
1760Intel ME can’t be 100% disabled but we can restrict the power of Intel ME by minizing its functions.
1761
1762(UPDATE:It might Now be Possible To Disable & Strip Down Intel's ME https://phoronix.com/scan.php?page=news_item&px=Intel-ME-Cleaning Via an open-source, third-party tool called me_cleaner )
1763
1764
1765
1766
1767
17684.It seems that there will always be bugs,or exploits,in the coding of programs,OSes,etc. and that there will never be error-free/bug free coding of programs,thats why theres a constant need for updating,your hardware,software,program, etc. even when patches or fixes are implemented that just brings more coding involved,and potentially create more bugs due to that one fix you created for that 1 bug.The best we can do is reduce the amount of coding,and make sure our very own patches don't create more bugs or exploits.
1769
1770
1771
1772
1773
17745.Trust is an issue,at some point you have to trust,that someone at the manufactory of your computer that you bought did not put a backdoor or any malware,on your new computer,other examples include but are not limited to your internet service provider (ISP),server operator,Tor developers etc.
1775
1776
1777
1778
17796.The host system clock synchronization mechanism still uses unauthenticated NTP from a single source. This is not optimal, but there is no real solution to this problem.A potential attack vector is created by this NTP behavior; the ISP and/or time server could either inadvertently or maliciously introduce a significant clock skew, or the host clock could simply malfunction.
1780
1781
1782
17837.Unfortunately, it is not yet possible to set a random clock offset for Qubes-Whonix VMs to prevent clock correlation attacks since it is unsupported by Xen. A related issue is denying Qubes-Whonix access to "clocksource=xen", which may not be possible without Linux kernel and/or Xen patches.
1784
1785
1786
1787--------------------------------------------------------------------------------------------------------
1788General and technical Notes
1789
17901.In linux use sudo instead of su.
1791
1792
1793
1794
1795
17962.It is possible to tighten the security so much as to make your system unusable,do it without over doing it.
1797
1798
1799
1800
1801
18023.Avoid using secure shell without requiring SSH keys,this prevents brute force attacks.
1803
1804
1805
1806
18074.when using SSH, implementing Fail2ban so only key authentication is allowed.
1808
1809
1810
1811
1812
18135.download over TLS and even better to verify the gpg signatures,and even better then those two is to obtain the software or item you want by creating by source code.
1814
1815
1816
1817
1818
18196. Intel Software Guard Extensions (SGX) supposedly has the ability to create a secure enclave within a potentially compromised OS. (update:here are some known weaknesses of SGX https://github.com/jovanbulck/sgx-pte )
1820
1821
1822
1823
1824
18257.TCP timestamps are disabled by default in Qubes R3.1 and above.
1826
1827
1828
1829
1830
18318.Constantly check for updates of outdated hardware and software programs.
1832
1833
1834
1835
1836
1837
1838
18399.Apply a BIOS password for BIOS set up and boot.
1840
1841
1842
1843
1844
184510.In Qubes always open attachments in DispVM.
1846
1847
1848
1849
185011.Most .bat's that you will see online will be malicious. Some are good though.Always open .bat files with caution.
1851
1852
1853
1854
1855
185612.Be weary of vulnerable apt-get downloads through untrusted Tor exit relays.
1857
1858
1859
1860
1861
186213.Users should understand that the system clock inside Whonix is set to UTC to prevent against time zone leaks. This means it may be a few hours ahead or behind the user's host system clock. It is strongly recommended not to change this setting.
1863
1864
1865
1866
1867
186814.The Whonix-Gateway state should not be suspended or saved. It is far better to power off the Whonix-Gateway if it is no longer needed.
1869
1870
1871
1872
1873
1874
187515.Similarly, if users suspend or save the Whonix-Workstation state, the clock will again lag behind the correct value.This can be manually fixed inside Whonix-Workstation by running: Start Menu -> Applications -> System -> Whonix Timesync.
1876
1877
1878
1879
1880
1881
188216.If the host clock value is grossly inaccurate - more than one hour in the past or more than 3 hours in future - Tor cannot connect to the Tor network.This is easily solved by manually fixing the clock on the host, then powering the Whonix-Gateway off and on again.
1883
1884
1885
1886
1887
188817.Another side effect of a significantly inaccurate host clock concerns operating system (OS) updates and cryptographic verification on the host. Until the host clock is manually fixed, it may no longer be possible to download updates or verify SSL certificates with the host browser.
1889
1890
1891
1892
1893
1894
189518.Users should always check whether a host clock defect relates to an empty battery before assuming the ISP is tampering with NTP.
1896
1897
1898
1899
1900
1901
190219.Spoofing the initial virtual hardware clock offset is useful to prevent Clock Correlation Attacks.
1903
1904
1905
1906
1907
1908
190920.For greater security, higher performance and a lower resource footprint, consider using an experimental MirageOS-based unikernel firewall that can run as a QubesOS ProxyVM.
1910
1911
1912
1913
1914
1915
191621.Store encrypted back-ups on a separate back-up disk that is already encrypted with LUKS or dm-crypt.
1917
1918
1919
1920
1921
1922
192322.Two things that have not been name spaced as of yet are time and kernel keystrings
1924
1925
1926
1927
1928
192923.Deactivate TransPort Test for better Stream Isolation.
1930
1931
1932
1933
1934
193524.Run all instances of Tor Browser in a DisposableVM which is preferably uncustomized to resist fingerprinting.
1936
1937
1938
1939
1940
1941
1942
194325.Selfrando provides a significant security improvement over standard address space layout randomization (ASLR) present in Tor Browser and other browsers.
1944
1945
1946
1947
1948
1949
195026.TCP Initial Sequence Numbers mitigation.
1951
1952
1953
1954
1955
1956
195727.set RELRO to "Full RELRO" instead of "Partial RELRO".
1958
1959
1960
1961
1962
196328.always use HTML5 instead of adobe flash.
1964
1965
1966
1967
1968
1969
197029.From time to time a user asks which incoming/outgoing ports are required by Whonix-Gateway. The answer is:
1971
1972Incoming: none.
1973Outgoing: all.
1974
1975An alternative technique for controlling ports might be corridor (a Tor traffic whitelisting gateway), since it can act as a firewall.
1976
1977
1978
1979
198030.JSONP (JSON with Padding) is a method commonly used to bypass the cross-domain policies in web browsers. (You are not allowed to make AJAX requests to a web page perceived to be on a different server by the browser.) Solution:should look to use Cross-Origin Resource Sharing (CORS) where possible.A taste of what this attack can do:https://www.nytimes.com/2015/06/13/technology/chinese-hackers-circumvent-popular-web-privacy-tools.html
1981
1982
1983
1984
198531.Mainframes:are notoriously difficult to get access to, making security testing difficult, if not impossible.Ayoub Elaassal, a security auditor at consulting firm Wavestone, was one of the lucky few who were able to access a mainframe for an audit.It didn't take him too long to find a vulnerability that, if exploited, could have given him root access to a mainframe and its vital, sensitive data."We could potentially compromise the whole system, and to whatever we want -- like intercepting transactions and issuing wire transfers,"
1986
1987
1988
1989
199032.NTP is a buggy and ancient protocol. Flaws in NTP clients can be remotely exploited to give an attacker control over the system,uninstall NTP clients on the host operating system and disable systemd's timdatectl NTP synchronization feature,this prevents time-related attack vectors which rely on leakage of the host time,and add sdwdate (Secure Distributed Web Date).
1991
1992
1993
1994
1995
1996
199733.Block incoming ICMP messages (and any traffic in general) with iptables or any of its frontends.Disable ICMP timestamps and TCP timestamps on the host operating system to prevent leakage of: system information, host time, system uptime, and fingerprinting of devices behind a router.
1998
1999
2000
2001
2002
200334.If a Trusted Platform Module (TPM) is available, use AEM protection to attest that only desired (trusted) components are loaded and executed during the system boot. Unauthorized modifications to BIOS or the boot partition will be notified.
2004
2005
2006
2007
2008
2009
2010
201135.Avoid dual booting,even if you are using encryption on your Qubes installation, /boot is still unprotected and could be maliciously modified by the other OS possibly leading to Qubes itself being maliciously modified.
2012
2013
2014
2015
201636.Open-source hardware is also not perfectly secure, since it is not "stateless", that is, lacking any persistent storage.
2017
2018
2019
2020
202140.CONFIG_GRKERNSEC_RANDSTRUCT_PERFORMANCE = increased security if turned off
2022
202341.CONFIG_GRKERNSEC_TPE = Cool feature that can prevent things from executing everywhere, no performance hit.
2024
202542.CONFIG_GRKERNSEC_SYSFS_RESTRICT = Might not work with Wayland and/or systemd ?
2026
202743.CONFIG_GRKERNSEC_NO_RBAC = If RBAC isn't going to be used it's better to turn this on to prevent any abuse, no performance hit.
2028
202944.CONFIG_GRKERNSEC_IO = No performance hit.
2030
203145.CONFIG_PAX_MEMORY_UDEREF = Some virtualisations solutions can take a huge performance hit with this security setting.
2032
203346.CONFIG_PAX_MEMORY_SANITIZE = 3% performance hit on single CPU system.
2034
203547.CONFIG_PAX_MEMORY_STACKLEAK = 1% performance hit on single CPU system.
2036
203748.CONFIG_PAX_MEMORY_STRUCTLEAK = Even less performance hit than STACKLEAK.
2038
203949.GRKERNSEC_CONFIG_PRIORITY_SECURITY = Choose this option if security is of highest priority for this deployment of
2040 grsecurity. UDEREF, kernel stack clearing, clearing of structures intended
2041 for userland, and freed memory sanitizing will be enabled for this kernel.
2042 In a worst-case scenario, these features can introduce a 20% performance hit
2043 (UDEREF on x64 contributing half of this hit).
2044
2045
2046
2047
204850.People who built computers in the early 2000's will tell you BIOS updates are risky, and they were, but not anymore.
2049
2050
2051
2052
205351.Good programming lanuages for security might be golang,D,Rust, and Ada.
2054
2055
2056
2057
2058
205952.Most programming languages higher level than C are much more secure when it comes to programming errors like Heartbleed's. Examples that primarily compile to machine code include D, Rust and Ada.
2060
2061
2062
2063
2064
206553.Whonix-Workstation Security:In Qubes-Whonix the best practice is to use DisposableVMs for all your internet activity. Alternatively, periodically delete your Whonix-Workstation AppVM(s) and create fresh instances from the Whonix-Workstation TemplateVM.
2066
2067
2068
2069
207054.Use a Yubikey to enhance the security of Qubes user authentication, mitigate the risk of password snooping, and to improve USB keyboard security.The Qubes Yubikey provides an easy way to integrate the Yubikey into your existing Qubes user authentication in order to mitigate the risk of having someone or something snooping on your keyboard while you type your password.
2071
2072It has been designed to be used with a USB AppVM to protect against USB based attacks.
2073
2074
2075
2076
207755.For greater security, advanced users should consider configuring the OS to avoid making core dumps. If possible, preventing access to process memory is also advisable, along with secure storage of the file system.Although core dumps are typically readable only by root,but may contain sensitive data (such as passwords or cryptographic keys), which are written to disk following a crash.
2078
2079
2080
208157.websites can easily determine whether you have allowed JavaScript for them, and if you disable JavaScript by default but then allow a few websites to run scripts (the way most people use NoScript), then your choice of whitelisted websites acts as a sort of cookie that makes you recognizable (and distinguishable), thus harming your anonymity.
2082
2083
2084
2085
2086
208758.SQL Injection flaws are introduced when software developers create dynamic database queries that include user supplied input. To avoid SQL injection flaws is simple. Developers need to either: a) stop writing dynamic queries; and/or b) prevent user supplied input which contains malicious SQL from affecting the logic of the executed query.
2088
2089
2090
2091
2092
209359.Configure sys-whonix to use corridor as a filtering gateway to ensure only connections to Tor relays pass through. This provides an additional fail-safe to protect from accidental clearnet leaks that might arise from hypothetical Whonix bugs
2094
2095
2096
2097
2098
209961.Anonymity is compromised if another NAT network adapter is added to the Whonix-Workstation. If this advice is disregarded, then your identity is leaked if/when infection occurs. Therefore, it is strongly recommended to always update over the Tor network. Although Tor updating is slow by comparison, it prevents inadvertent leaks.
2100
2101
2102
2103
210462.Avoid using wireless keyboards and mice because most send data unencrypted. Even if this wasn't the case, there is no way to verify the robustness of the cryptography involved in proprietary products. A local adversary (up to 100 meters away) can sniff keystrokes and inject their own, allowing them to take over the machine.
2105
2106
2107
2108
2109
2110
211164.Torrify apt-get traffic on the host to prevent fingerprinting and leakage of sensitive security information.Apt-transport-tor is a package that allows host operating systems or non-Whonix-Workstation VMs that are not behind a torifying gateway (like Whonix-Gateway) to torify their apt-get traffic for individual repositories.
2112
2113Strictly speaking, there is no need to use apt-transport-tor inside Whonix VMs since all traffic is already routed over Tor. apt-get is stream isolated using a preconfigured uwt wrapper. In other words, apt-get in Whonix is already talking to a Tor SocksPort. Nevertheless, apt-transport-tor will be the default in Whonix 14 because it provides better error handling and stream isolation
2114
2115
2116
2117
2118
2119
212065.TCP timestamps provide protection against wrapped sequence numbers,but the downside of TCP timestamps is adversaries can remotely calculate the system uptime (and boot time) of the machine and the host's clock down to millisecond precision. These calculated uptimes (and boot times) can also help to detect hidden network-enabled operating systems, as well as link spoofed IP and MAC addresses together and more.
2121To prevent this information being available to an adversary, it is recommended that TCP timestamps are disabled on any operating systems being used. The less information available to attackers, the greater the security.Disable TCP Timestamps via kernel sysctl. Note this boolean disables it for both IPv4 and IPv6 - both are controlled by the same sysctl option.
2122
2123
2124
2125
2126
2127
212866.Ada language is designed to prevent common programming errors as much as possible and is used in critical systems where a system bug might have catastrophic consequences.Many issues can be mitigated through proper coding style, code review, unit tests, etc. but having them done at the language level means that you get it for free.It is also worth adding that despite the fact that a language designed for security such as Ada removes many classes of bugs, there is still nothing stopping you from introducing business logic bugs that the language doesn't know anything about.
2129
2130
2131
2132
2133
2134
213567.Do not use C (and C++)
2136
2137Technically, it is possible to write an implementation of C which would be "safe" and still formally conforms to the C standard, but at a steep price (for instance, you have to make free() a no-operation, so allocated memory is allocated "forever"). Nobody does that.
2138
2139problem:The big problem with "don't use C" is interoperability with other languages. Pretty much any language supports writing a wrapper for C libraries.
2140
2141
2142
2143
2144
214568.Metrics Portal:provides analytics for the Tor network, including graphs of its available bandwidth and estimated userbase;
2146
2147 Atlas:is a web application to learn about currently running Tor relays; and
2148
2149 ExoneraTor:answers the question of whether there was a Tor relay running on a given IP address on a given date.
2150
2151
2152
2153
2154
2155
2156
215769.USBKill is an anti-forensics script written in the aftermath of the SilkRoad trial. Its purpose is to trigger protection events that prevents adversaries from siphoning files/installing malware/running a mouse jiggler. It creates a USB white-list of allowed devices of which anything else plugged into the machine causes it to erase the computer's RAM and immediately shutdown. This can be adjusted to exclude all devices. It can also be used in reverse, with a white-listed flash drive in the USB port attached to the user's wrist via a lanyard serving as a key. In this instance, if the flash drive is forcibly removed, the program will initiate the desired routines.
2158
2159
2160
2161
216270.The MAC address is normally not traceable because it is not passively sent to computers beyond the local router.However, other computers on the local network can potentially log it.Also,due to weaknesses in current spoofing methods it is likely the MAC address can be enumerated via the physical characteristics of the Wi-Fi card.If users intend to use an untrusted, public network then MAC spoofing should be considered.Spoofing is only necessary if you expect to travel with your laptop or PC. It is not required for home PCs that do not change locations.
2163
2164
2165
2166
2167
216871.If the user's home network has a cable modem internet connection, the ISP either provides the cable modem device as part of the service or requires pre-registration of the MAC address of the self-provided cable modem in order to setup the service.
2169
2170If a user manages to hack or change the MAC address of the modem, the service would immediately cease functioning because the IP address assignment is apportioned for, and bound to, that specific MAC address. As a result, when connecting from behind a cable modem/NAT router, MAC address spoofing of the computer's ethernet adapter may be pointless. If a user is traced, the trackable endpoint will be the MAC address of the cable modem device.
2171
2172
2173
2174
2175
2176
2177
217875.In the case of flash based storage like SSDs and USBs, never storing data unencrypted in the first place is the only solution to protecting data.
2179
2180Unlike HDDs overwriting data on SSDs is no longer effective in wiping the disk.The most important consequence of this is that old passwords may still be around, potentially for a very long time because fast erase by overwriting the header and key-slot area is insecure.Example: You change your password because you notice it was exposed to shoulder-surfing or CCTV recording. On a SSD the old password is still retrievable and can be used to decrypt the master key and your data because secure overwriting no longer works as with magnetic disks.
2181
2182Also wear-leveling mechanisms like TRIM leak information about the filesystem that can aid forensics.You must keep TRIM disabled (the default) during Linux LUKS-encrypted installs.
2183
2184
2185
2186
218776.Cache-based side-channel attacks are a serious problem in multi-tenant environments, for example, modern cloud data centers. We address this problem with Cloak, a new technique that uses hardware transactional memory to prevent adversarial observation of cache misses on sensitive code and data. We show that Cloak provides strong protection against all known cache-based side-channel attacks with low performance overhead.
2188We demonstrate the efficacy of our approach by retrofitting vulnerable code with Cloak and experimentally confirming immunity against state-of-the-art attacks. We also show that by applying Cloak to code running inside Intel SGX enclaves we can effectively block information leakage through cache side channels from enclaves, thus addressing one of the main weaknesses of SGX. https://www.microsoft.com/en-us/research/publication/strong-efficient-cache-side-channel-protection-using-hardware-transactional-memory/
2189
2190
2191
2192
219377.Here is a list of additional programming language features that (I think) make it much harder to write unsafe code. The first five features expand the compiler's capabilities in reasoning about your code, so you, a human being prone to error making, don't have to*. In addition, these features also should make it easier for a fellow human being, an auditor, to reason about your code. OpenSSL's source code is often described as a mess and a language stricter than C could have helped to make it easier to reason about. The last two features are about context issues that affect security as well.
2194
21951.A strict type system: Makes it easier to reason about program correctness. Eliminates certain input attacks.
2196
21972.Immutable by default: having immutable values as the primary data container means it is much easier to reason about the state of your program.
2198
21993.Disabled or restricted unsafety: Don't allow scary things such as pointer arithmetic (e.g. Go), or, at least only allow it if wrapped in big fat warnings (Rust). Note that a language lacking in pointer arithmetic completely is excluded for use in a huge number of applications that require low level access.
2200
22014.Compile time taint checking: expand the type system to allow identifying tainted values: values that depend in some way based on input. The compiler could then (conditionally) forbid operations with a tainted value that leak information to outside observers, such as branching on such a value. This could prevent or at least migitate certain classes of timing attacks. As far as I know, these are only available in static code analysis tools, and not in compilers themselves?
2202
22035.Dependent types: dependent types are a means to tell the compiler that "here is an Int whose values are between 2 and 87" or "here is a String of maximum length 12 containing only alphanumeric characters". Failure to meet these requirements results in compilation failure, and not a runtime failure with likely unsecure results. This feature is available in Idris and some theorem prover languages.
2204
22056.Absence of garbage collection: Garbage collection is a big problem for language safety - it creates garbage collection pauses in your program. These pauses leak information about the state of your program and allow timing attacks to happen. When the garbage collector is invoked is impossible (or at best incredibly hard) to predict as a developer, however, and subject to huge changes for even the smallest amount of code changes.
2206
22077.Performance, portability & interopability: It may be fine if you have need for a secure and slow program that only runs on the PowerPC platform, but don't expect anyone else to use it for a cross-platform TLS library. OpenSSL is popular precisely because it's fast and runs everywhere from obscure MIPS-based routers to massively parrallel SPARC servers and everything in between. Furthermore any program or runtime in the world can interface with OpenSSL as a library because it uses C calling conventions.
2208From my limited knowledge of languages, no language does all of these. Rust is an example of a language that covers many - it is strict, immutable by default, has restricted unsafety, does not require garbage collection and is quite performant and portable. Compile time taint checking and dependent types presently appear to be exotic features that require either additional static code analysis tools or new languages, unfortunately.
2209
2210
2211
2212
2213
2214
2215
221678.We study the effectiveness of countermeasures for trafï¬c analysis attacks within our proposed framework. Two basic countermeasure strategies are (a) to pad the trafï¬c with constant interarrival times of packets (CIT) or (b) to pad the
2217trafï¬c with variable interarrival times (VIT). Our experiments show that CIT countermeasures fail when the adversary uses sample variance or sample entropy of packet interarrival times for statistical analysis. On the other hand,
2218VIT countermeasures are effective regardless of which sample statistics are used by the adversary. These observations
2219are validated by analysis of detection rates based on sample
2220distributions of packet interarrival times.
2221Key Words - packet interarrival times, trafï¬c analysis attacks, statistical analysis, statistical pattern recognition
2222
2223
2224
2225
2226
222779.Security researchers have successfully broken one of the most secure encryption algorithms, 4096-bit RSA, by listening — yes, with a microphone — to a computer as it decrypts some encrypted data. The attack is fairly simple and can be carried out with rudimentary hardware.
2228
2229Acoustic cryptanalysis, carried out by Daniel Genkin, Adi Shamir (who co-invented RSA), and Eran Tromer, uses what’s known as a side channel attack. A side channel is an attack vector that is non-direct and unconventional, and thus hasn’t been properly secured. For example, your pass code prevents me from directly attacking your phone — but if I could work out your pass code by looking at the greasy smudges on your screen, that would be a side channel attack. In this case, the security researchers listen to the high-pitched (10 to 150 KHz) sounds produced by your computer as it decrypts data.
2230
2231Acoustic cryptanalysis is actually surprisingly dangerous. Imagine if you were decrypting some files in a library, coffee shop, or other public space — someone could obtain your decryption key just by placing their phone near your computer. Alternatively, an attacker could use spear phishing to put malware on your phone that listens for the decryption key. With HTML5 and Flash able to access the microphone, it would be possible to build a website that listens for encryption keys too. The researchers propose one particularly nefarious scenario: Put a microphone into a co-located server, slot it into a rack in a data center, and then scoop up the encryption keys from hundreds of nearby servers.
2232
2233If you want to keep your data secure, you only really have two viable options: Heavy-duty encryption, physical security, and ideally both at the same time. If an attacker can’t get physically close to your data, it instantly becomes much harder to steal it. As far as mitigating acoustic cryptanalysis attacks, you either implement physical security — keep your laptop in a sound-tight box, or never let anyone near your computer when you’re decrypting data — or you need to use a “sufficiently strong wide-band noise source.†Something like a swooping, large-orchestra classical concerto would probably do it.
2234
2235
2236
2237
2238
2239
2240
224181.Normally the dial-up or broadband provider knows your name, postal address and non-anonymous payment method. If Tor or Whonix is compromised, then an adversary only needs to pressure the service provider to confirm your identity. This is not the case if using an anonymous WiFi adapter plugged or integrated into the Whonix-Gateway.
2242
2243For safer use, it is recommended to:
2244
22451.Buy the WiFi adapter anonymously in a store, second-hand or on the street.
22462.Never provide personal data during a purchase.
22473.Do not use the adapter for prior, non-anonymous activity. Some providers or hotspots log MAC addresses and the username (if paid).
22484.If possible, only use free hotspots or pay for them anonymously. Otherwise abstain from paid hotspots.
22495.For greater security, always use a new, distant, random, non-circular hotspot location.
2250
2251
2252
2253
2254
2255
225682.Onionizing Repositories
2257
2258When Whonix, Debian and Qubes packages are installed or updated, default settings point to repositories with a http:// URL.However, experimental Tor hidden services are already available for the Whonix, Debian and Qubes packages.
2259
2260There are several security and privacy benefits of using Tor hidden services:
2261
22621.The user cannot be uniquely targeted for malicious updates (attackers are forced to attack everyone requesting the update).
22632.The package repository, or observers watching it, can't track what programs are installed.
22643.The ISP cannot easily learn what packages are fetched.
22654.End-to-end authentication and encryption provides protection against man-in-the-middle attacks e.g. version downgrade attacks.
2266
2267
2268
2269
2270
227184.Attention must also be given to changing the usual Tor entry guards used for connections.Entry guard changes are necessary for every Tor instance on the user's machine host (apt-transport-tor) and guest.An authentication technique can fingerprint devices - and also track user devices as a side-effect - by observing inter-packet timings on a LAN's wire-segment. The timing effects are the result of how various components in a machine create packets.Fortunately, this technique cannot be used to identify devices across the internet.This technique can be defeated by inducing random delays in a machine's packet stream. Since there is no concern about impersonating other devices on the LAN, it doesn't matter that such an authentication system will view such machines as "unknown".
2272
2273
2274
2275
2276
227785.not related to security but still helpful https://gyazo.com/c73be243e9508b7f82f0a15fea607930
2278
2279
2280
2281
2282
2283
228486.Locking down your web site (in Apache)
2285
2286If you are the owner of a web site and have SSL security on it, you can “lock it down†so that the only cipher that your web site supports is “256-bit AESâ€. This takes the choice out of the end user’s hands — either they use AES or they don’t connect securely. This is a good thing to do for very sensitive sites. However, the “danger†is that some of your users may be using web browsers that do not support AES (like old versions Internet Explorer), and thus will not have any access to your site unless they change browsers.
2287
2288To lock your site down to support 128-bit and 256-bit AES only (to get AES but not require 256-bit, so that some browsers like iPhone and such will work), you would add to your Apache httpd.conf file:
2289
2290SSLCipherSuite AES256-SHA:AES128-SHA
2291
2292This can be added globally, in a virtual host, or even in your .htaccess file. It will ensure that any successful connection to your site will use one of these ciphers. Just be sure to add it to the secure settings for your site and not just the insecure site area!
2293
2294In general, for a high security configuration for Apache, you will want to support only TLS v1.0+ and only NIST-recommended cipher suites.
2295
2296
2297
2298
2299
230087.offline APT package manager
2301
2302apt-offline is an Offline APT Package Manager.
2303
2304apt-offline can fully update and upgrade an APT based distribution without connecting to the network, all of it transparent to APT.
2305
2306apt-offline can be used to generate a signature on a machine (with no network). This signature contains all download information required for the APT database system. This signature file can be used on another machine connected to the internet (which need not be a Debian box and can even be running windows) to download the updates. The downloaded data will contain all updates in a format understood by APT and this data can be used by apt-offline to update the non-networked machine.
2307
2308apt-offline can also fetch bug reports and make them available offline.
2309
2310
2311
2312
2313
231488.VM images that are built with frozen sources rather than current sources (including Whonix)
2315is that latest stable releases sometimes contain vulnerable, remotely exploitable applications that are very likely to be used over untrusted networks that are in a position to run man-in-the-middle attacks. One example of this is [CVE-2014-6273] in apt-get.Self-created builds from source code using current sources would solve this.Although using Current Sources comes with its own issues.
2316
2317
2318
2319
2320
2321
2322
232390.Cleaning a Compromised System
2324So, you didn’t patch the system and it got hacked. What to do? Well, let’s see:
2325
2326
2327
2328You can’t clean a compromised system by patching it. Patching only removes the vulnerability. Upon getting into your system, the attacker probably ensured that there were several other ways to get back in.
2329
2330
2331
2332You can’t clean a compromised system by removing the back doors. You can never guarantee that you found all the back doors the attacker put in. The fact that you can’t find any more may only mean you don’t know where to look, or that the system is so compromised that what you are seeing is not actually what is there.
2333
2334
2335
2336You can’t clean a compromised system by using some “vulnerability remover.†Let’s say you had a system hit by Blaster. A number of vendors (including Microsoft) published vulnerability removers for Blaster. Can you trust a system that had Blaster after the tool is run? I wouldn’t. If the system was vulnerable to Blaster, it was also vulnerable to a number of other attacks. Can you guarantee that none of those have been run against it? I didn’t think so.
2337
2338
2339
2340You can’t clean a compromised system by using a virus scanner. To tell you the truth, a fully compromised system can’t be trusted. Even virus scanners must at some level rely on the system to not lie to them. If they ask whether a particular file is present, the attacker may simply have a tool in place that lies about it. Note that if you can guarantee that the only thing that compromised the system was a particular virus or worm and you know that this virus has no back doors associated with it, and the vulnerability used by the virus was not available remotely, then a virus scanner can be used to clean the system. For example, the vast majority of e-mail worms rely on a user opening an attachment. In this particular case, it is possible that the only infection on the system is the one that came from the attachment containing the worm. However, if the vulnerability used by the worm was available remotely without user action, then you can’t guarantee that the worm was the only thing that used that vulnerability. It is entirely possible that something else used the same vulnerability. In this case, you can’t just patch the system.
2341
2342
2343
2344You can’t clean a compromised system by reinstalling the operating system over the existing installation. Again, the attacker may very well have tools in place that tell the installer lies. If that happens, the installer may not actually remove the compromised files. In addition, the attacker may also have put back doors in non-operating system components.
2345
2346
2347
2348You can’t trust any data copied from a compromised system. Once an attacker gets into a system, all the data on it may be modified. In the best-case scenario, copying data off a compromised system and putting it on a clean system will give you potentially untrustworthy data. In the worst-case scenario, you may actually have copied a back door hidden in the data.
2349
2350
2351
2352You can’t trust the event logs on a compromised system. Upon gaining full access to a system, it is simple for an attacker to modify the event logs on that system to cover any tracks. If you rely on the event logs to tell you what has been done to your system, you may just be reading what the attacker wants you to read.
2353
2354
2355
2356You may not be able to trust your latest backup. How can you tell when the original attack took place? The event logs cannot be trusted to tell you. Without that knowledge, your latest backup is useless. It may be a backup that includes all the back doors currently on the system.
2357
2358
2359
2360The only way to clean a compromised system is to flatten and rebuild. That’s right. If you have a system that has been completely compromised, the only thing you can do is to flatten the system (reformat the system disk) and rebuild it from scratch (reinstall Windows and your applications).