If you want to block traffic to a whole network you have to do it at the network border. In the simplest case of a network with a single connection to the Internet (typical home network) this would be the Internet router. Most home routers have a GUI allowing you to add this kind of rules, often under the heading "Firewall".

Alternatively you can perform the iptables command you quoted (or its equivalent for other operating systems) on every host in the network. This may prove impractical or impossible depending on the number and types of hosts in your network.


How to store OTP seed securely at the validating server

You can encrypt the OTP seed using a symmetric key derived from user's password. However, this requires the user to enter the password before entering the OTP, otherwise the server cannot decrypt the OTP seed.

Alternatively, you could have a highly secure server that gets passed the encrypted OTP seed and returns a currently valid OTP. Symmetric key for seeds is stored on this server. HSM could also help you here.


A destructive force can always leak information through HTTP packets. Should I bother configuring outbound rules on my firewall?

You're confusing several things.

First, pretty much every standard protocol (save for FTP which you should avoid like plague) has only a handful of standard ports. Since these ports are standards, they will not change often and therefore will not need to be updated.

Now, some applications will require specific ports to be opened, Typically, that's handled through an exception process: the application owner will submit a request to the firewall team for an access to be open. Usually, this request is limited to a specific range of internal systems, going to a specific range of external system with a specific list of ports. This request can then be filled as documentation and, if it is granted, the firewall configuration can be updated accordingly.

But your questions shows that you're approaching this incorrectly. What you're asking would be like asking if locking your home door is worth the effort since you know that some people have access to bulldozers. The proper process for designing a strategy for protection is:

Identify the assets you want to protect
Identify the threats you want them protected against
Identify the proper measures to mitigate those threats
Audit your result
Go back to step 1.

You seem not to do any of these except step 3.


Is it impossible to have a PDF file execute a command without abusing any exploits?

Adobe Reader allows javascript in PDF to be interpreted (initially to allow features like form validation).
You can manually edit your PDF in notepad++ to add scripts in javascript.
One time I made a phishing campaign exercise based on this usecase. The script asked for a login password in a form to "open the protected document" and then they are sent over internet to my C&C (the action to send data to internet raise a warning to the user).
This resource should help you : https://www.decalage.info/file_formats_security/pdf


If somebody is looking for you, he could find out your public IP address (by for example sending you a link to a web page on a server that he hosts, or even a known public forum post with an embedded image that is hosting on his server). In your case that IP address is actually the IP of your Cafe. That would bring him close to you, but too close you.

Your computer has just a private IP address assigned by the Cafe to which you connect, but that IP address would not tell anything about your location.

But based on the strength of the WiFi signal that is being sent from your computer, it would be possible to identify your location, in case someone has the right tools and has identified your appriximate location or the locatinf of the Cafe to which you connect.

I assume that you do not share your GPS data of course.

If you would use TOR, it would be much harder to find you or the IP of the Cafe you are connecting to.


How to set up TLS without a certificate authority on a site for internal use

If you can arrange for the correct certificates to be reliably recognized by clients, then all you need is to produce your own certificate "by yourself", traditionally as a self-signed certificate. Tutorials are easily found for that, e.g. with Linux tools or Windows IIS.

You might also want to run your own CA (e.g. with this software), and install the CA certificate in the client browsers -- this is extra initial complexity, but will make things simpler if you need to change some certificates later on (e.g. if the previously installed certificates expire).


How to exploit publicy known vunerable version of jquery?

One important distinction to make here is that only because the jQuery library contains known vulnerabilities, it does not mean that the website is vulnerable to the contained vulnerability.

As with many libraries, a website using jQuery will only be affected by a vulnerability if it uses the vulnerable function in vulnerable way. If it does not use the functionality at all, the issues will not be exploitable. They might become exploitable if the used functionality on the website changes.

Looking for example at the mentioned jQuery 2.1.1. This version is, according to the site http://research.insecurelabs.org/jquery/test/ vulnerable to

jQuery issue 2432 - 3rd party $.get() auto executes if content type is text/javascript
jQuery issue 11974 - parseHTML executes inline scripts like event handlers

The first issue (https://github.com/jquery/jquery/issues/2432) can be exploited only if the vulnerable site uses $.get() for a URL that returns a response that can be influenced by you. If you cannot control the URL or the content, only a theoretical threat exists. The website owner of the site where the URL points could theoretically execute a XSS attack against the site that uses the vulnerable jQuery version in the mentioned way.

The second issue (https://bugs.jquery.com/ticket/11974) can only be exploited if the website uses the function $.parseHTML() and you can influence the input to that function. If is does not use the function in the described way, you cannot exploit the issue.

To wrap things up:
If you see the message "Vulnerable version of the library jquery" you will have to look at the JavaScript code that is actually used by the website and identify if it uses the vulnerable functions in a way that can be exploitet by you. If it doesn't, you cannot create a proof of concept exploit or exploit the vulnerability.


The phrase "bitwise cipher" is most likely XOR'ing the base64 of the plaintext with a key of the same length. This is the most basic kind of symmetric cipher.

Try XOR'ing the base64 of the plaintext with the ciphertext they give you to get the "key". Then XOR this key with the challenge text to decrypt it.

And yes, I am aware this is an old question and the course is probably over by now.


Mac OS X vulnerabilities and not having the need for an antivirus?

I think you're hearing information that was generally thought by not so tech savvy people that a Mac doesn't require AV, or is less susceptible to attacks. That's a very bad assumption, and the idea was brought about by individuals who gave Windows a bad stigma, and were pro-Apple.

Some individuals learn that Mac is based on Unix/Linux. They learn, or rather think, that Linux is more secure than Windows, or they hear that Windows is insecure. While this can be somewhat true and I would be more willing to say Linux is a little more secure than Windows, it still doesn't make the system immune. The reasoning behind this logic was at the time a lot of vulnerabilities were posted that were related to Windows Operating Systems because of the fact that a lot of businesses used Windows. So a lot of early on attacks were targeting Windows OS's because they were the go to in the corporate world, and even in today's world most businesses will have a majority of their systems running Windows.

Mac is no less vulnerable to attacks then Windows or any Linux distro. It's important for any individual using technology to have a basic understanding of potential security threats and vulnerabilities. Without going into too much detail, it's true that Windows is much different than a Unix/Linux based OS, they both have their strengths and weaknesses and both are susceptible to attack.

Macs can and will get malware just like the rest of the operating system world, and Macs can and will get attacked just like the rest of the Operating System world.

When it comes to security arrogance is a downfall.


Why require new users to change password?

It would be convenient for me to have them keep their initial password because I am in a smaller business setting, and if I know their password I can set up Google Drive Sync and Google Apps Sync for them, instead of having to write instructions for them on how to do this themselves.

This is exactly why it is good practice to require them to change passwords after first login;  they should be the only ones who know their passwords.  It eliminates any potential for administrative abuse, or the perception of abuse even if none exists.   Additionally, passwords they choose are less likely to be forgotten and require reset, or to be written down where they can be stolen and (again) abused.

Your second question about period password changes has already been answered in the following question: How does changing your password every 90 days increase security?


Added value of Windows Server 2008 over 2003 in terms of security

There's a lot of added value in Server 2008 as compared to 2003. You can, roughly speaking, think of Server 2003 as "XP" and 2008 as Vista. In which case the following are notable changes that impact security:

UAC, UIPI are brought in in Vista. That is, Administrator users are handed two authentication tokens - one with full admin privileges and one with filtered privileges (standard user privs). This is what explorer starts with, thus, most apps are run as a standard user by default, even on an admin account. UIPI allows these windows to share a desktop whilst theoretically keeping them isolated.
Address Space Layout Randomisation. Vista got a full implementation of this.
Proper logon credential handling - whereas previously one could totally re-write the logon dialog with a GINA, now you install credential providers. Risk of intercepted passwords is thus decreased.
In 64-bit versions of XP and Vista, Kernel Patch Protection. Prevents rootkits from hooking interrupt tables by force-bluescreening Windows if they do. Very handy.
A series of protocol improvements were introduced, possibly most notably SMB 2.0.
and so on...

The Vista kernel and operating system was in many ways a very audacious release, containing a whole slew of additional features. There really is no reason to stay on 2003 if security is your end game.
That said, if you're considering an upgrade, practicalities come into play. Server 2008 R2 is already in production use and Server 8 is not that far distant either. I wouldn't upgrade to 2008 given the choice of R2 or Server 8 - I'd be inclined to wait for S8.


Access Control Badges -- Plain or Printed IDs?

ISO 27001 recommends following in terms of authentication and securing access:

Two-factor/Multi-factor authentication shall be applied to ensure secure authentication to the most sensitive/critical critical facilities, information systems, and applications.

Example of Two-factor authentication: Card + Pin, Card + Thump (preferred), etc

Hence whether you are going to use plane/printed card it's always recommended to use two-factor authentication to mitigate risks.

Further to your question of whether to use blank cards, the best practice is to print the details of the owner/user of the card as the responsibility of the card should be with the owner/user and it will be used to identify the (part of identification process) user by physical observation in 'visual security checks' (may be at reception/entrance security guards).

Hence It is always recommended to have Two-factor authentication process with printed access cards (could be used as Employee ID card as you've indicated) allowing to have a visual check also top of the Two-factor authentication.

Hope this clarifies...


How much information a Flash program (Flash app) can gather about computer when running?

To answer your question, there are a number of elements that I will try to discuss as briefly as possible in order to have a better grasp of the whole issue. Note that I exclude totally any Adobe Flash vulnerabilities that may be a threat to the user's privacy as it is not what you are asking about.

Can I get hardware and operating system information with Flash?

You need to look to the Capabilities class and see what information it can get from your operating system and hardware. For instance, the cpuArchitecture property  specifies the current CPU architecture. The cpuArchitecture property can return the following strings: "PowerPC", "x86", "SPARC", and "ARM". The server string is ARCH. while the os property specifies the current operating system.

Note:
This paragraph does respond to the question whether such data may be sent using a Flash web application over Internet or not. That will be discussed later on.

What is a Flash web application?

A Flash web application is any SWF/FLV content that can vary from  a video you want to view on your browser to a full fledged and complex  application where Flash plays a very important role such as in sharedtalk.com
What are local shared objects?

The problem with running Flash web application (apart from the Flash vulnerabilities that you are not addressing here) resides in what we call local shared objects (LSOs) better known as Flash cookies. Flash cookies are relatively unknown (Schneier on Security: Flash Cookies).

While an HTTP stores only around 4KB of data, a Flash cookie contains up to 100KB data (ActionScript3.0 Cookbook). You can even enhance the storage capacity of a Flash cookie at your will. A Flash cookie is not stored in a file within the browser space but in a separate Adobe file with a .sol file extension: this means the browser has no control over Flash cookies and when you clear your browser's cookies, Flash cookies are still there on your computer (but there are tools to delete them).
Which content may be stored within a Flash cookie?

For HTTP cookies where contents are determined by the specific website that created that cookie. Contents vary from site to site. This applies for Flash cookies.

The Flash cookie is used generally to save user's settings (for example when you watch a video on Youtube and change the dimensions of the video screen: the dimensions are stored in the Flash cookie).
What are the main privacy issues inherent to LSOs?

Flash cookies contain the information that may be hold in an HTTP cookie and much more except the field related to expiration date: Flash cookies do not have an expiration date by default as it is the case with HTTP cookies (where the common practice of companies' websites set it usually set to 30 days); and one of the reasons for this is because when companies tracking users noticed that lot of users clear their cookies at least once per month lead  to overestimate  the number of true unique visitors to websites, and thus to the overpayment for advertising companies  (The  Impact of Cookie Deletion on the Accuracy of Site- Server and Ad-Server Metric s: An Empirical Comscore  Study).

But what is worse, is that a Flash cookie may recreate HTTP cookies you previously deleted (respawning cookie, persistent identification element)

Note that the less aggressibe LSO contains the globally unique identifier that identifies your computer for the web application that tracks you.
What is Flash hardware acceleration and why to mention it?

Hardware acceleration is  when you have hardware designed to accelerate a specific function. So, for example, when you decode or encode video you do it on the CPU. Some video cards allow you to do this on their GPU instead, so you now have "hardware accelerated video decoding". (What does “hardware acceleration” refer to?). Flash hardware acceleration is a hardware acceleration for Flash (Performance or display issues with certain Flash videos). In most browsers this feature is disabled by default, but activating it to better visualize a given web Flash application exposes you to reveal more information about your hardware.  But why to mention this? Because such information is stored in LSOs.
So may my OS and hardware information be leaked out?

I prefer to quote you this directly from the official documentation (Flash player help)

  Note that it is the person or company that has created
  the application you are using that is requesting such access, not
  Adobe (unless Adobe has created the application that wants to save the
  information). It is the responsibility of the person or company
  requesting access to make it clear to you why they want access and how
  they plan to use the information they save. You should be aware of the
  privacy policy of anyone who is requesting access to your computer.
  For example, see the Adobe privacy policy. Contact the website
  requesting access for information on their privacy policy.

Also, one important thing to read from that documentation:

  (Flash Player 8 and later) If you have downloaded SWF or FLV content
  to your computer, a dialog box might appear alerting you that the
  content is trying to communicate with the Internet. Flash Player 8 and
  later versions do not allow the local SWF or FLV content to
  communicate with the Internet, by default.

And since it is possible to retrieve both OS and hardware information using the Capibilities class described in the first point, and a Flash web application may require, under your permission as you can read from the same last link, more than 100KB, and if the web application is nefarious the definite answer to your question is that it is likely, I mean possible, to happen especially with a misinformed user about security issues.


Can we reverse engineer binlog with row format to make MySQL AES_ENCRYPT visible?

There is a description of what MySQL does here. It takes the key almost as is and applies AES in ECB mode, which is weak since it leaks which blocks are identical to each other in data encrypted with a given key. You should not assume that data which was encrypted with MySQL's AES_ENCRYPT() is really "secure".

That being said, whether your key and data will make it to the binary log depends on how it was configured. If using statement-based formatting, then the binary log will contain the SQL statements which were issued (at least those which entail modifications), and your data and key may be revealed that way. If you use row-based formatting, then the log contains the results (alterations to actual rows), and your cleartext data and key won't appear in the log. See this question for pointers.


Policy implications of changing passwords versus disabling accounts in Active Directory

You are correct, the ideal off-boarding process would be to disable the user. However there are situations where the user has company data that is located on his personal profile, be it on premise or in the cloud.
Since cloud and on-premise services usually could have some kind disabled user data purging configured. You'd rather be on the safe side and change the password instead of disabling the user.
Also even with cloud services you sometimes have glitches and can't change the user that is in charge of a certain process or task and you'd rather ride it out. In many organizations the IT manager is asked to take ownership of the user's account and to copy files that were left on the profile.


The canonical resource for the concept of secure-by-design is "The Protection of Information in Computer Systems" by Saltzer and Schroeder. The essence is distilled into their 8 principles of secure design:

Economy of mechanism
Fail-safe defaults
Complete mediation
Open design
Separation of privilege
Least privilege
Least common mechanism
Psychological acceptability

These principles, laid out in 1974, are still fully applicable today.


How to test the security of a hardened Web Browser?

If you want to test the sandbox capabilities you need something like a real exploit which will try to do something an attacker would do. But I think it is not really possible for you to get a exploit for a current browser. So you have the following options:

Test the sandbox with a custom executable by creating a executable which use the sandbox techniques and will try to execute a payload. The results could be comparable if your browser does not use sandbox techniques by itself.
Test your sandbox with an older version of your browser and a public available exploit.
Simulate an exploit attempt by introducing custom code in your browser like system("wget http://127.0.0.1/t.elf; chmod +x ./elf; ./elf"); If your browser is open source you could for example create a custom version of your browser and add the custom code in a code region where also a real vulnerability would be.


How to secure an application deployed in some port

If you're using an established protocol, such as ssh or http or whatever, use an/the established authentication scheme for that protocol (and, for network protocols that aren't inherently secure, use a secure transport such as TLS). If you're using a custom protocol, first ask yourself why you are doing this (the network and CPU overhead of something like JSON via HTTPS are almost certainly worth spending to get the developer convenience of working with a well-established toolset) and if you decide you absolutely must do it, tunnel it through TLS (or DTLS or some other secure protocol, if you must) anyhow, and then either do a standard require-credentials-and-issue-session-token auth or use TLS client certificates (mostly a matter of how much control you'll have over clients and how easy it needs to be to add new users).

To be clear, though: all of this is for how you authenticate a user. You cannot ever meaningfully restrict what clients connect to your server; it is a fool's errand to try. Anything that your client can do, I can clone in my own client. Just authenticate the users.


Are security flaws acceptable if not much harm can derive from them?

Yes. This is a problem - a big problem.
Lately I found a design flaw in a business' webshop that allowed me to insert innocent notes in other visitors' charts.

Seems innocent, and only annoying, until I looked further and found that I was also able to insert Javascript code (XSS) into those notes. So in other words, I could exploit XSS on every visitor's chart.
I made a quick PoC showing them how I could easily hack the computer of any visitor (in this case myself, it was a PoC) using that design flaw, XSS, BeEF, and Metasploit.

So even the smallest flaw may result in a big risk after all.

Besides that, who says that the error you found is the only one the developer of that website made?
Maybe he also made tons of other mistakes.

Reporting would be the best you could do - even if it looks unnecessary.


Can I get malware on my phone, if my phone is tethered to my laptop downloading torrents?

By just passing (potentially malicious) traffic through, it is very unlikely. After all, routers on the Internet are relaying tons of malicious traffic everyday without getting compromised themselves.

However the danger begins when your computer itself gets compromised from a malicious file downloaded via torrents, and from there the malware on your computer could compromise other hosts on your network such as your phone.


Any protection that is implemented in user-level can be relatively easy defeated. Most often is used so called "obfuscation". It can be time consuming to deobfuscate such script if to do it by hand. However, there are several tools that automates this process, example - https://addons.mozilla.org/en-US/firefox/addon/javascript-deobfuscator/ Best solution is to implement protection in interpreter itself, at bytecode level, like Zend Guardian for PHP (even it is bypassable). I suppose, for JavaScript this cannot be done due to many JS engines implementations, parser engines differences, etc. Additionally, it would require loading modules that have to be distributed by protection vendor. This is hard and not transparent process.

I have seen interesting protection in malware, in that case JavaScript code was protected with RSA and used key from the server. But again, it is headache for developer to support such process. Probably for malware writers it was worth to protect their exploits against AV's, lurking users, researchers.

Additionally, you can read related topic here: https://stackoverflow.com/questions/964652/javascript-protection


Do I need CSRF token if I'm using Bearer JWT?

This is relevant but doesn't necessarily answer 100% of your question:

https://security.stackexchange.com/a/166798/149676

The short of it is that as long as authentication isn't automatic (typically provided by the browser) then you don't have to worry about CSRF protection.  If your application is attaching the credentials via an Authorization header then the browser can't automatically authenticate the requests, and CSRF isn't possible.  Therefore, I would re-word the quote from your article slightly: it isn't that Bearer Tokens are the best defense against CSRF attacks, but simply that CSRF is an attack vector that specifically attacks requests where the browser automatically provides authentication (typically cookies and basic authentication), and so CSRF doesn't matter if the browser can't authenticate you.

You should probably make sure and verify, server-side, that your application isn't silently falling back to cookie validation if the Bearer token is absent.  I could see something like that squeaking into an application by accident, and since the cookies will get sent along whether you want them to or not, it could result in an inadvertent CSRF vulnerability on a page that is was "supposed" to be immune to CSRF.

As a result, I think both your questions one and two can be answered the same way.  If you only use authentication via Bearer tokens and not via cookies, then there is no concern of CSRF vulnerability, and no extra steps are required for security.


Essentially you want to apply a Bayesian analysis to a corpus of work, to state something about the likelihood that you would believe an exemplar to be a member of the set constructed by your suspect. That analysis is well-known (and there's a whole statistics stackexchange site, too). You need about as big a corpus of suspect and non-suspect material as a decent spam filter uses.


How to get information about segments of physical memory not described in System.map on linux

Your System.map file contains virtual addresses of static symbols of the table. It is not a physical memory map of your system. The virtual memory space is not contiguous and can have large holes in it, the specific layout depends on choices made by the kernel developers. On x86_64 bit linux, negative addresses (i.e. those with the high bits set, such as 0xffffffff81000000) are reserved by the kernel for kernel mode. Check out the Linux x86 memory map for more information on how the kernel lays out its virtual memory space.
If you want more information on what's where in the kernel, the kernel exposes its symbol table to the root user if it's compiled with the KALLSYMS option in /proc/kallsyms. There's a detailed explanation of the difference between /proc/kallsyms and System.map in this question.
Finally, if you are interested in the physical memory map of the system, that is provided by the BIOS or UEFI to the system on boot. Your kernel logs this to the kernel message buffer (which you can query using dmesg) pretty early on in the boot:
[    0.000000] BIOS-provided physical RAM map:
[    0.000000]  BIOS-e820: 0000000000000000 - 0000000000098c00 (usable)
[    0.000000]  BIOS-e820: 0000000000098c00 - 00000000000a0000 (reserved)
[    0.000000]  BIOS-e820: 00000000000e6000 - 0000000000100000 (reserved)
[    0.000000]  BIOS-e820: 0000000000100000 - 00000000bfea0000 (usable)
[    0.000000]  BIOS-e820: 00000000bfeae000 - 00000000bfeb0000 type 9
[    0.000000]  BIOS-e820: 00000000bfeb0000 - 00000000bfec0000 (ACPI data)
[    0.000000]  BIOS-e820: 00000000bfec0000 - 00000000bfef0000 (ACPI NVS)
[    0.000000]  BIOS-e820: 00000000bfef0000 - 00000000c0000000 (reserved)
[    0.000000]  BIOS-e820: 00000000ffc00000 - 0000000100000000 (reserved)
[    0.000000]  BIOS-e820: 0000000100000000 - 0000000c40000000 (usable)

You can find this information at runtime in /sys/firmware/memmap.


Unknown process shuts down computer when ending process tree

This seems to be some form of malware based on you description and update. I suggest you get out your back ups and look at restoring your OS, unless you want to clean your PC but risk malware residual being left behind


In my opinion going for SEC560 then SEC660 and SEC760 after that you can go confidently for the OSCP , OSCE.

  note : if you got took SEC560 ,660 ,760 you dont really need to go for off-sec certs , but it you want more experience .. go for it

If you're more into Web Application Penetration Testing you better go for SEC542 then Take the SEC642 then the OSWE

  note : OFFENSIVE-SECURITY certifications are cheep comparing with the GIAC
  Certs but they're much harder to get , you need to study for at least two
  months for them "full time studying"

If you want to be a pentester "only" then follow my plan

but if you're planning to get a master's degree or GSE then you better follow the specified courses

  read more about the GSE : https://www.giac.org/certification/security-expert-gse

  read more about the SANS Pentesting certs program : https://www.sans.edu/academics/certificates/penetration-testing

I dont think that you really need GSEC or GISF
because you're already familiar with some of the most important tools and you have a good understanding of the hackers tools and techniques

  if youre going for the Web apps i suggest you get a copy of the owasp web app pentesting methodology from this link : owasp. org/images/1/19/OTGv4.pdf

note : i'm the youngest GPEN holder on earth and i asked your question to the SEC560 instructor and that was his answer


What is the proper flow for authentication?

The way you described your problem indicates, that oauth is not what you are looking for. Oauth is used to allow your users to use their credentials from a different entity (identity provider) to log in to your application and to access user data from the idp.
The idp and the application that uses the idp are two different entities (e.g. two different companies). So for example: on honeypot.io i use my github username and password. Honeypot forwards me to the github idp. I log in and grant honeypot access to my user information (name email etc). The github idp forwards me to honeypot again with an access token und honeypot.io gets my user data along with the guarantee that i own that account. Honeypot will then create an account for me with my github data.

If there is only one party involved (your case) you dont need an idp and no oauth. Depwnsing on the concrete use cases you might just want to allow accounts to use multiple usernames, which would be a simple array / list.


How to trace the remains of deleted files?

At a high level, the answer is, that we know something about the files or directory structure. If we know something, that means that we can look for it on a disk, even if it is not in the current directory tree.

This may sound very abstract, and it probably is. If you have a Linux system available, you can use a small (stay below the 1G if you can) USB stick for experimentation. I say small, because larger takes more time.

On the USB stick, create a file with an text editor, with something like this:

't Was brillig and the slythe toves
 did gyre and gimble in the wabe

Once you are satisfied that the file is there, delete it.

Plug it in your Linux system and do

sudo strings /dev/sdx1 | grep brillig

(replace devx1 with our actual device name). You should see the first line of Jabberwocky.  It this case we knew it was ASCII-text (so we used strings to filter it out) and it contained brillig.

In most files, there is a starting set of bytes (called Magic Number) that allows you to determine what kind of file it is. For example, if you see a sector starting with 0xffd8, there is a fair chance that it is the beginning of a JPEG file (not certain, but a fair chance). Wikipedia has a whole list of those magic numbers.

There are many tools in the forensics discipline, that might even allow  the recovery of files. On the low-level, the Linux/Unix dd allows you to low-level copy parts of the disk file.


allow user to delete individual sessions on account, safe to embed sessions in HTML?

Would this be considered good practice or is there a better way to do this?

No, this doesn't seem to be ideal.

The biggest problem I see is that you put a session id into the HTML of a page. It is best practice to make session cookies httpOnly to make XSS a bit harder to exploit. By putting the session id into the HTML, you leak that information in case of XSS, thus making httpOnly useless.

This may also be a problem if sensitive data is stored in a session, as someone who hijacked one session or account now has access to all sessions. The impact seems minor, but it doesn't seem ideal and may be a problem depending on the application.

Additionally, you don't have any CSRF protection which - while bad practice in general - doesn't have a security impact in this case as this isn't a very sensitive action and an attacker would need to know the session id, which they don't. Still, it doesn't seem ideal and also violates RESTful.

Finally, it's never a good idea to put sensitive data in a URL, it should instead be submitted via POST as it may otherwise leak in various ways. Again, this is likely not a security issue, as the data is useless as soon as it is used, but it doesn't follow best practices (and may be a problem, eg when the delete didn't work).

I would suggest to use ids that are independent of the actual session id, and to submit them via POST instead.


Are LFI attacks possible (removing extension) in PHP 5.4.4+?

I don't think this will allow someone to directly include /etc/passwd, but there's still a lot of trouble to be had from this.  An attacker might be able to:

Trigger a DoS by including the file itself.  (Since you're using include, not include_once, it'll recursively keep including the same file.)
Include arbitrary scripts on your system, such as copies of phpinfo, leaking sensitive information.
Include arbitrary code if they're able to upload files with user-defined extensions.

Please note that if you have allow_url_include=1 in your php.ini, you're opening up for a remote file inclusion vulnerability.

A better approach is whitelisting your pages, or at least using something like basename() or realpath() + dirname() to prevent directory traversal attacks.


Can't Amazon see my files if I use s3cmd/gpg with a complex password?

See https://s3tools.org/s3cmd-howto for information on how you can configure s3cmd to use GPG on the client side, to encrypt files on the client side before they are transferred to Amazon s3, using a key stored on the client side.
Notably:

You can optionally enter a GPG encryption key that will be used for
encrypting your files before sending them to Amazon. Using GPG
encryption will protect your data against reading by Amazon staff or
anyone who may get access to your them while they're stored at Amazon
S3.


Why would a phishing blacklist be hashed?

Why hashed? What security problem does that solve?

I could imagine several reasons for this decision:

Using the shorted hashes saves a lots of space.
While it is possible to easily lookup specific URL's it is impossible to find out the whole list and then maybe reverse engineer parts on how Google creates this list in the first place. This makes it harder to work around the blacklist in a generic way, i.e. create URL's which have the highest chance to not get accidentally detected.
It takes efforts to create this list and Google might just want to protect their intellectual property.

  It seems all hashing does is cripple the list's potential usefulness.

Usefulness for whom? Note that this blacklist is intellectual property by Google and is obviously not intended to be open source. If this would be Google's intention then
they could simply publish the whole list and provide the tools needed to build the hashed version from it. The same way you could ask why Cisco does let you query OpenDNS for free but does not offer the list of all domains considered malicious by OpenDNS for download.


What happens when a firewall blocks a traceroute?

There is no "blocking" of traceroute, tracepath, tracert or whatever the tool gets called. These commands work by setting the TTL/hoplimit of the packet to a specific value and then expect the host to send an ICMP unreachable back if the TTL/hoplimit expired (i.e. decremented to zero). If a system does not send this ICMP message or if a middlebox (like a firewall) blocks the delivery of the ICMP packet then the host with the specific TTL/hoplimit will show up as unknown in traceroute.


How to write an authentication module for my website?

You don't. You use the authentication and authorization modules provided by your framework.

My goto web framework is Python's Flask framework. Flask-Login is an excellent module that provides an easy to use API that handles the bulk of the authentication work. Flask-Security is another module that encompasses Flask-Login as well as various other security modules. This isn't unique to Python and Flask. Java for example, has Apache Shiro.

Don't roll your own. There are quite a few gotchas that you have to take note of when writing authentication and authorization code. Use battle-tested frameworks and save yourself the headache.


HP Protect Tools Security Manager integrates well with Windows and it lets you configure requirements to require a fingerprint and password if you want. I haven't had a look at any other current ones.


Block HTTPS/TLS (Wo)Man in the Middle Attack

In general, it is easy to get some information about the browsing of a person.  The information that is leaked is:

site that you are using
approximate length of the URL
approximate length of the page
approximate number of other resources
time

See Are URLs viewed during HTTPS transactions to one or more websites from a single IP distinguishable? for a more elaborate explanation.
In a corporate environment, there are a number of vendors that deliver TLS decryption, for example Palo Alto does this. In general this requires that the MitM-device CA has been accepted as valid on your computer. You may have done this inadvertently, though with Chrome, that is very hard. Or someone with access to your computer may have done this. If the latter: if they install certificates like that, they may have done other things as well. You may want to re-install.
Key-loggers are also an option.
It may be important to know that there is no legal way for your landlord to do this without your explicit and informed consent (at least in the EU).
The second part is how to prevent this.
Depending on your level of paranoia, there are two things you can do:

reinstall the systems
use a VPN (NordVPN, ExpressVPN, etcetera)

It is also possible to flood your landlord's logs:
while : ; do
   ranhost=$(cat /dev/urandom | tr -dc 'a-zA-Z0-9' | fold -w 32 | head -n 1)
   wget https://$ranhost.com
done

which will make it harder for him to extract the real URLs that you use, and will also give him the signal that you know he is doing something illegal.


Why is it required in OAuth 2.0 that refresh token cannot be guessed?

... since when the client wants to obtain an access token using the refresh_token grant type, it MUST send a client ID and a secret key in the body of the request...

According to RFC 6749 this statement is not entirely true. The refresh token is the only information a client needs to obtain a new access token.

However this is only the case for public clients as defined in section 2.1 of the specification. You could imagine the client id and the client secret as a sort of license to consume an API to provide certain services to your customer. But you need a special permission of every customer to consume their resources from the API. The access token is the representation of this permission. However you would not give your license to consume the API away to a customer. This would be the case in many browser and mobile device applications.


REST API stateless authentication using social login

Token expiration may take place on the server side causing the client to reauth after x time.

If youre looking to do social logins this method should be fine as long as youre transmitting the data over SSL and not saving credentials (U/P Combos) on your systems. The login endpoint should be running on HTTPS (again, read, secure) and should be connecting to the 3rd party endpoint, securely.

If you're looking for a good (free) solution, Firebase.com (mostly a cloud relational database) has a great section for including 3rd party authentication, its my preferred system, but i also use their database a lot.

Cheers HTH


Is removing the Ethernet cable from the router (when I'm not using it) a good security measure?

If there is not an internet connection to your device then a hacker is not going to be able to communicate with that device. (Edit: As some have pointed out...this is assuming an attacker is attempting over the internet from a remote location)

With that said, eventually you will have to connect to the internet again if you want to use the internet and if you were to eventually obtain malware on your computer such as a keylogger. That keylogger is going to rely on the internet to send its data back to the hacker. If the keylogger is written properly, when you disconnect, it will just wait for you to connect to the internet again to send its data back to the attacker.

In my opinion, I think disconnecting from your internet will prove to be more of a hassle than a protection. Instead, focus on the security of your device and your actions on the internet. Being a smart internet user can provide a great deal of security to your device.

Elaboration (EDIT):

I do agree that this method with decrease the time of opportunity for an attacker but the reason I chose to put emphasis on endpoint security and user education is because if you imagine an enterprise environment, they have devices and services that rely on an internet connection 24/7. So an enterprise can't rely on disconnecting from the internet as a viable security measure. Instead they focus on securing the devices on the network and the network itself. So I believe this will achieve 2 things: 1) greater security. 2) better user experience(always have internet access on demand) and I believe you can apply these strategies to your personal network as well.


Is there a viable open source antivirus for OS/X?

This is really two questions and aren't really handled well by a single program.

The antivirus question is easy, you'll be wanting ClamX. It is an OSX port of the venerable ClamAV engine. It is widely considered to be the default AV for Unix/Linux systems.

For your other question, free utilities that have good Mac integration may be hard to come across. The best tool I can think of would be a software firewall called Little Snitch. Since you can have it ask you to approve connections, as well as define what applications are allowed to talk to where, you might be able to accomplish what you need.

Now, with all that, keep in mind that if your computer is already infected, you can't trust the output of either of these applications. Clever viruses will just bypass the applications and continue working anyway. Applications like this are really useful for preventing yourself from being compromised, or detecting lame infections.


Requirments for a PCI Compliant Sales Receipts

When people say PCI, they usually mean the PCI DSS ("Data Security Standard").  That doesn't address your question, however; it has much more to do with backend systems and online processes.  On the question of receipts, all the DSS says is "Mask PAN data before printing on a receipt" and "Protect receipts in storage."

The card brands and the banks have more extensive requirements, and that's probably what you're looking for - for example, the Visa Rules.  Looking at the current revision, cardholder name is only required in a specific instance:

I could be wrong - it's not spelled out - but I believe "manually imprinted" refers to old-fashioned receipts formed by sticking the card and a carbon paper duplicate form into a small tray and CHUNK-CHUNK imprinting the card number onto the paper by slamming a sliding weight back and forth.  So I don't think that requirement applies to you.  And it expired in April 2017 anyway.

Simplest solution is to tell the client that you need a reference to the documented requirement before you can implement it correctly.  If they provide a reference, and it applies, then you should implement it.  If they can't, then you can't implement it according to (nonexistent) specification, and shouldn't try, and you can just tell them that.


You can use an hash of the ids. For example, in pseudo-code,

sha2(entry_id || delimiter || user_id)

will do what you want:

all the users will see the same content on the same id,
not the users, not even potentially cooperating different users will be able to identify the entities by their hashes.
however, all the user will see the same entity behind the same hash.

The disadvantage of the method is that you need a backend storage for the per-user hash keys - the users will refer the entities only by their hash, and not even you will be able to decode out the entity from them.

You may get increased security by binding the hash to the session instead of the user:

sha2(entry_id || delimiter || session_id)

This will increase security (not even the user will be able to identify the entities between their sessions), and you will need to store the hashes only until session timeout. However, the user will be unable to produce a client-side entity storage (what may be also an advantage, too).


What is the most secure way of transferring a secret between 2 processes running on the same system?

If your threat model includes "malicious processes running as the same user as the legitimate process that needs the key", you need to go back to the drawing board and redesign. It is not possible to protect against that. Processes within a single user session are not, and should not be expected to be, secure from one another.

The concern you express about pipes, for example, extends to any other kind of IPC mechanism. TLS sockets with mutual auth? Any process that can connect to the socket can also be impersonated by another process in the same user context, reading the same key data, and spoofing the legit process. Even if you could securely establish the IPC, that's no guarantee that the data would be secure. For example, some operating systems (Windows notably, but I think also some Unix-likes) allow any process running under a given use to debug any other process under the same user, so the malicious process could just read the secret right out of the legit process' address space.

OK, let's talk about scenarios where you don't assume that another process in the same user context as you is malicious. Maybe that's because you (re)designed the whole thing so that it runs under a special user context used only for the specific purpose of your software. Maybe that's because you're working on an embedded device where you control all the code that runs. Maybe it's just because you accepted that trying to defend against malicious code with the same privileges as you is hopeless and pointless (if the bad guys are executing code in your user context, it's already game over, man).

You didn't specify the OS that your software needs to run on. However, in general, there are a few decent choices here for secret that you don't ever want to commit to persistent storage.

On Unix-like systems:

Unix domain (local) sockets. Fast and fairly straightforward. Support bidirectional communication, if that matters. To be secure, you just have to create them in a location that is neither readable nor writable by any other user (something under the user profile is a popular choice). On the other hand, you said you can't host a listening socket on the Master (why not?) so this may not work.
A named pipe, also called a FIFO. Fast and straightforward, but unidirectional only (if you want bidirectional, you need to create a pair of pipes). As with the local socket, make sure the FIFO is created where no other user can access.

On Windows:

A named pipe. Unlike Unix named pipes, Windows pipes don't go in the standard file system; there's a special "named pipe file system" for them. This means you need to ensure you create the pipe with the right access control list (ACL). Once created, though, using the pipe is fast and simple.
A named memory mapping. The CreateFileMapping API can be used to create a memory mapping that is not backed by any normal file, but instead by the system paging file. While the pagefile is backed by persistent data and therefore could lead to the secret being stored on disk, that is a risk with any process; you can't guarantee that the secret won't ever be paged out of working memory unless your platform offers (and you use) some kind of kernel-secured buffer. Meanwhile, an attacker wouldn't know where to look for the secret in the pagefile, so you're probably safe. Named memory mappings, like named pipes, must be secure using an ACL that prevents processes running under other users from opening the mapping. Once both parties have opened the mapping, though, it's very fast.
Direct memory access (read, most likely) between processes. The client process simply reads the secret out of the parent's virtual address space. This requires a way to pass the relevant address to the other process, but it's OK if that address is exposed; other users can't access the process' memory even if they know where to look, because processes always have an ACL that prevents other users from reading their memory.


What are the main reason to deploy Secure Web Gateway?

What would be the protection that Secure Web Gateway only provides,
other appliances don't?

In your scenario, the answer is none.
Per Gartner's definition:

Secure Web Gateway
Secure Web gateway solutions protect Web-surfing PCs from infection and enforce company policies. A secure Web gateway is a solution that filters unwanted software/malware from user-initiated Web/Internet traffic and enforces corporate and regulatory policy compliance. These gateways must, at a minimum, include URL filtering, malicious-code detection and filtering, and application controls for popular Web-based applications, such as instant messaging (IM) and Skype. Native or integrated data leak prevention is also increasingly included.

In other words, an SWG is aimed at protecting the clients on your network while browsing the internet, not protecting your network from clients accessing your published web services.
An appliance like FireEye and/or Websense comes to mind.


What reasonable steps can I take to secure a used computer against malware or hardware modification?

About the software side first:

Yes, absolutely wipe the disks.
It will defeat most malware (because most are simply not sophisticated enough to remain somewhere else ), ti helps the privacy of the previous owner, saves you some possible legal troubles because of software licenses and/or confidential data, etc.

Anf of course, you have clean and fast system, instead of all additional garbage that collected with long-term computer usage before; with the settings and softwares of your choice only.

About the "how" - it should go without saying that wiping is not deleting files in Windows. However partitioning and/or dd from /dev/zero isn't enough anymore either.

With eg. an Linux USB (or any other system capable of this) first wipe both disks eg. with dd from /dev/zero, and then for the SSD also run a "secure erase" eg. with hdparm. Because due to wear levelling etc., the dd only isn't enough there. Since it is a laptop (often without SATA hotplug capabilites) and many buggy USB connectors, it might be a bit tricky, but nonetheless recommended.

And the hardware ...

It depends who you want to protect against.
 - The previous owner who was an average computer user?
 - State-level actors, HW vendors, and technical people capable of actually writing BIOS malware etc., who might have done something while (or before) the previous owner was using the computer?

For the first:
 - Per definition above, these people are not capable of doing much. Maybe able to buy a keylogger in the internet, but else...
 - Yes, flash the BIOS. Not so much because of malware, but just to have an update.
 - Make sure that, if you have Intel ME/AMT, that it is at least disabled completely. If you don't need it, I'd recommend using me_cleaner to get rid of it as much as possible. (In case you dont know what ME is, this "feature" allows full remote control of the computer, even when turned off (but with power). Of course the intended usage is that unauthorized people get no access. However the previous owner might have configured access for himself, and furhtermore there are several known security bugs).
 - If you want, open the computer and identify what each part is for. Eg. a small black box plugged in between keyboard and mainboard might save your typed passwords and probably shouldn't be there...

For the other group: If you think they might have done something with this computer (and something they don't do to all computers in your country etc.), then do not use it.
Even with all technical knowledge of the world, searching "something" they could have done would be searching a needle in a haystack. It isn't worth the effort. And of course we don't have "all" knowledge either.

Jus to address the BIOS / mainboard firmware: Updating it per software is useless against malware in it, because updating requires the cooperation of the mainboard (of course). If there exists some malware already, it just could say "ok, update finished" without actually replacing the infected parts.
As the relevant data usually is in a distinct device on the mainboard, changing it with proper hardware is better (as the turned-off mainboard can't prevent it). However, even if you find someone to do that, it's just one of very many possible attack vectors, so...

Related example: Devices like hard disks, network cards and CPUs have their own firmware. What about these? Right, you would have to replace them too (because of this cases, the next computer repair shop too has no tools anymore to force in clean data). And then you can replace everything and end up with a new computer.


Can postMessage be used to forward data to hacker's iframe in CSRF attack?

One iframe does a GET on the page with the password and sends this password via html5 windows.postMessage() to another iframe (sourcing the attacker's site) which takes this password and sends it off to the hacker's site via a query parameter in an http get to a hacker's web service.

postMessage is done with Javascript. This means one can not force a postMessage with just a CSRF attack unless the victim page is explicitly designed in a way, that arbitrary postMessage calls to cross-origin pages can be triggered by a simple POST or GET request. Instead the attacker would need the ability to inject script to trigger a postMessage, i.e. it needs Cross-Site-Scripting (XSS). But if XSS is possible there is usually no need to make it overly complex by using postMessage.


Can a VPN Provider MitM my SSL traffic without me noticing?

How does the provider forward the traffic without exposing my IP, but also without breaking the SSL.

SSL is protection (like encryption) on top of TCP which sits on top of IP. The underlying layers (TCP, IP) can be changed without changing the data transported. This means that the encryption can be kept even though your IP address at the network layer is changing.

This is similar to having an encrypted mail (i.e. PGP or S/MIME). It does not matter if it gets transported via multiple mail servers, gets stored on different machines etc - the encrypted part of the mail itself and its inner content will not be changed.

  ... but how do next gen firewalls like palo alto claim they can do deep packet inspection on ssl traffic without the users noticing?

They don't. If the inner contents of SSL connections need to be analyzed the DPI system does a man in the middle "attack", i.e. it is the endpoint of the SSL connection from the perspective of the server and decrypts any traffic and encrypts it again to present it to the client. Usually this will result in security warning to the user since the new certificate for the connection (created by the DPI system) is not trusted. But this can be made more transparent to the user if the user explicitly trusts the DPI appliance.

For the details to this see How does SSL Proxy server in company work?, Deep Packet Inspection SSL : How DPI appliances prevent certificates warnings? or Is it common practice for companies to MITM HTTPS traffic?.

  Why can't the VPN provider just use a similar box to decrypt it?

It actually could do this.

Only, in theory users would need to explicitly trust the VPN provider for inspecting SSL traffic similar to what is done in companies. But, if you for example install the VPN software provided by the VPN provider, this software could actually silently trust the computer the VPN provider for SSL interception so that you don't realize that the provider can sniff and even modify the encrypted traffic. This silent installation of trusted certificate authorities is actually what many antivirus products do, so that they sniff encrypted traffic and protect the user from attacks delivered inside encrypted connections.

One could in theory find out that the provider is doing this by looking at the certificate chain for each SSL connection and comparing it to the expected one. Or one can look at the locally trusted certificate authorities and see if there was one added. Still, if you install software from the VPN provider the provider could also change parts of your system like the browser in order to hide the inspection from you. And this is not restricted to software given by the VPN provider - any software you install could actually make such changes.

See also How can I detect HTTPS inspection?.


Proper Linux user authentication through PAM aware applications

As you ouline, due to the limitaiton of /etc/shadow access, at some level, your application will either have to access that file or access some other module/service which has access to that file. There is no avoiding it if you want a solution which uses locally managed user credentials (unless you totally roll your own, which I strongly recommend avoiding).

I think your best approach is to separate the authentication component. Apart from having the benefit of limiting your exposure surface, it has another great advantage not yet mentioned. From your post, it seems this software will run at client sites, some of which may have LDAP, some of which will not. If your authentication component is modularised/separate from the core of your application, you have the possibility of getting the best of both worlds. Basically, your client site can use the method which fits best with their architecture.

Keeping the environment as straight-forward and consistent as possible is almost as important as using the right technology. Many security problems arise because the environment or architecture is too complicated. Changes get made by someone who doesn't fully understand the full implications and the next thing you know, you have a major security hole.

If you write your application in such a way that it can pass off authentication to an external module, you can allow sites to select what fits best for them. They avoid having to manage yet another identity source, can ensure consistency across their envrionment and possibly get additional benefits, such as single sign-on or same sign-on etc. You could provide a 'default' auth module which uses PAM for those sites that don't have LDAP or similar.

The challenge with this approach is in selection or definition of the interface. How should the communication occur? I would keep it simple. Possibly domain sockets, but perhaps other standards, such as SAML 2.0 may be worth checking out.

You may also be intersted in this article, which talks about using PAM to control service access

https://www.linux.com/news/featured-blogs/203-konstantin-ryabitsev/699697-how-the-linux-foundation-and-fedora-are-addressing-workstation-security

Also, depending on the deployment platform - redhat or debian based, you should check out SELinux and AppArmor for ways to limit potential problems, such as restricting what resoruces an executable is allowed to access etc.


Objectives of TLS_FALL_SCSV and finished-message

A typical behavior of tolerant TLS clients (i.e. browsers) is that they first try a connection with the best TLS protocol version they can. If this fails because of handshake errors, close of the server or similar strange errors they will retry again with a lower TLS protocol version in the hope that they deal with a buggy server which can only properly deal with lower TLS versions.

Since this behavior could be misused by an active man in the middle to enforce a downgrade to a lower and less secure TLS version in order to make use of possible insecurities in this version. Therefore modern clients either don't do such downgrade any longer or they add the TLS_FALLBACK_SCSV pseudo cipher to signal that this is not the best protocol version they could offer. A server which understands this pseudo cipher can thus detect if some man in the middle attempted a TLS version downgrade.

A finished message will not help in this scenario because it will detect modifications of the current handshake but not TLS downgrade because of a connection close inside the handshake which was caused by a man in the middle.


The Economics and White Hat Nature of NSS ExploitHub

I think you are absolutely along the right lines. The only use for a developed exploit for a known vulnerability is to prove to a disbelieving client that it can be done.

The vast majority of pen testing for a mature client is to confirm/refute their security posture. They do their job, secure and harden the architecture, platforms and applications and then run a penetration test to see whether they missed anything or misconfigured.

Even when our testing takes escalation and vulnerability chaining into account, the usual scenario is:

Run external tests - see what vulnerabilities exist
From point on DMZ run tests assuming attackers beat your 1st layer
From point on core network run tests to see what an internal attacker, or one who passed your outer layers can do

While test teams really enjoy testing which allows them to run a full suite end to end, they are getting rarer, as it is not as cost effective for the client.

The key assumption has to be: if an exploit exists which could provide an attacker with a useful way in to a high value target it will be weaponised, and funded by groups who can pay far more than people like NSS.

Practically, once a vulnerability is known, you should protect until a patch comes out (use other mitigating controls) and then patch. The actual exploit itself isn't necessarily as important.


How would I know if my Apple Mac has a virus, and what can I do if I have?

Yes, Macs can be infected by malware, too - just like basically any other computer system. They have been explicitly targeted by malware creators in the more recent years, which coincides with their gain in popularity.

The question on what options there are for cleaning such a system can get philosophical. Personally I would recommend you to reinstall the operating system completely from scratch. While even this isn't a guarantee for a clean system, everything short of that is just messing around and hoping.

I'm not familiar with Mac OS X at all, but there are definitely anti virus products, just like for Windows itself. Personally I'm not convinced that you actually need something like this, but it always comes down to how good you behave yourself.


Configuring election website to prevent MITM attacks

Use SSL sitewide. Enable SSL (https).  Make sure that any attempt to connect via http immediately redirects to the SSL site.
Follow accepted best practices. Refer to SSL/TLS Deployment Best Practices from SSL Labs.  Follow all of the advice there, including use of using SSL for all site traffic, marking all cookies as secure, avoiding mixed content, enabling HSTS, and other recommendations.
Avoid third-party scripts. Avoid third-party script (i.e., any Javascript downloaded from any other domain).  Avoid trusting any other sites or domains.  For instance, don't use third-party widgets or analytics; don't use ads; host all Javascript locally, on your own server.  They present an element of risk, and an elections context that sort of risk is probably unnecessary and undesirable.
Buy an EV cert. Spend the extra amount to get an extended validation (EV) certificate.  This will provide users with an extra level of assurance.
Use pre-loaded HSTS and public key pinning.  Register your domain with Google Chrome and Firefox, to request to add your domain to Google's and Mozilla's pre-loaded HSTS list.  This helps defend against SSL stripping and man-in-the-middle attacks, even for users who have never visited your domain before (and thus haven't had a chance to receive the initial HSTS information from your domain).  Enable pre-loaded public key pinning with them, as well, if you can.
Use forward-secure ciphersuites. Configure SSL on your web server to enable forward secrecy for all clients that support the corresponding ciphersuites.  See Deploying forward secrecy from SSL Labs for details on how to do this.  Generally speaking, you'll set the order of preferred ciphersuites on the server so that ECDHE is your first choice of ciphersuite; DHE is your second choice; and standard (non-forward-secure) ciphersuites are lower priorities.  Forward secrecy helps protect the confidentiality of all earlier communications (including voters' votes) if the server's private key is compromised after the election, which seems helpful in an elections context.
Support TLS 1.2. Make sure you support the latest versions of TLS, for voters with browsers that support those versions.  The latest versions of TLS are not yet supported by all browsers, but they add defenses against some recent attacks on SSL.
Check your site. After deployment, check your SSL configuration using the SSL checker at SSL Pulse (provided by SSL Labs).  Make sure you have a grade of A.  Fix any issues that the SSL checker spots.
Advertise the https URL.  When you communicate with voters to tell them what web page to visit to vote, list the full https: URL.  For instance, tell voters to enter https://www.elections.us into their browser, not http://www.elections.us or www.elections.us (the last two are treated identically by browsers, and may be vulnerable to MITM attacks).


Is dot character safe against sql injection?

I don't think it will open you up to SQL Injection.

That said - while I am not an expert on Prestashop or it's code base, I got the impression that the sanitize function you linked to is not just used to prevent SQL Injection, but multiple kinds of vulnerabilities (notice the call to strip_tags on line 102).  If this is true you should be careful that you aren't opening yourself up for other types of vulnerabilities.  The first one that comes to mind by allowing . is directory traversal.

Ideally, allowing the . character as input wouldn't open you up to this type of attack, but without doing a security audit of the code I can't say for sure.

Also - if they aren't using parameterization for protection from SQL Injection I would be very concerned about the overall security of their code.  The concept of rolling your own SQL Injection protection has been discussed at great length in the security community and the consensus is that it is almost never a good idea.

So in summary - I don't think the . opens you up to SQL Injection, watch out for other vulnerabilities and be wary of Pretashop's approach to security.


Is there an implementation of a trust on software on a host?

What you're describing is pretty much what "truted computing" is about: a tamper-resistant TPM chip contains an RSA key baked into it by the manufacturer.

You can achieve similar result using other type of tamper-resistant cryptographic storage (HCM, smartcards, DRM dongle, etc) where private keys are stored on specialized hardware and, theoretically, impossible to extract or duplicate.


You are referring to the interpretation guide here in your question.  The interpretation guide is meant to give insight into the justification for the requirement as well as some additional guidance if necessary.  You are not evaluated against the Interpretation Guide, so if you see conflicting statements, it is always best to source from the Standard first and foremost.

Requirement (from the Standard)

1.3.1 Implement a DMZ to limit inbound traffic to only system components that
provide authorized publicly accessible services, protocols, and ports.

Testing Procedures:
1.3.1 Verify that a DMZ is implemented to limit inbound traffic to only system components that provide authorized publicly accessible services, protocols, and ports.

Guidance statement (from the Interpetation Guide):

1.3.2 Limit inbound Internet traffic to IP addresses within the DMZ.

Termination of IP connections at the DMZ provides opportunity for inspection and restriction of source/destination, and/or inspection / blocking of content, thus preventing unfiltered access between untrusted and trusted environments.

So the standard doesn't say that you need to implement an analysis engine.  It just says in the guidance document that you have the opportunity to analyse.  Application firewalls are handled in section 6.6.


Reasons to pick JWT:

Does not require the server to keep a state, i.e. no need for costy lookup on every request.
Easier to share authorisation across different domains.

Reasons to pick session cookies:

Easier to implement in many languages and frameworks (e.g. PHP).
Instant revocation of authorisation, e.g. logging a user out, is possible. Even with a more complex two token system revocation is not instant if you use JWT.

When doing something simpe for a few users in PHP, you do not need the benefits of the JWT. Given that PHP comes with an existing implementation of sessions, I would just use that to avoid unnecesarry complexity. But for a different project with different needs the answer can be different.


No.  Consider that when you're using a computer, you're just interacting with software that's reading and writing these files.  Anything your intended software can do, malicious software can do.  That being said, you could use Trusted Boot, Full Disk Encryption, and run only signed/verified software on your machine.  Using an air-gapped (never connected to the Internet) machine would also make it harder for an attacker.

Security is not an absolute state, it's just a question of making it cost more for the attacker to attack it than the data is worth to them.  If you believe it will be worth it for the CIA to attack you, then there's a good chance Rubber-hose cryptanalysis will work if all else fails.


Nmap reporting the status of a port as both opened and closed

You are not providing much information about the target host. Is it a host you own and configured yourself? Or is this a scan of a 3rd-party host?

Assuming it is a 3rd-party host, I would suggest that the reason you observe this sort of behavior is because this host is behind some sort of network Intrusion Prevetion System or stateful firewall that implements Port Knocking.

When you perform nmap scans without explicitly specifying the port range, nmap scans by default the most common 1000 ports. During this scan, nmap accidentally* connects to the right sequence of ports in order to trigger a "knock", which results in dynamic modification of the firewall rules in order to allow connections to the ports you mentioned.

When you explicitly specify the port range, the "secret handshake" of connecting to a specific port sequence never happens and the firewall keeps dropping any traffic destined for those ports.

Given the fact that you observe such behavior both with top 1000 common ports and with other arbitrary large ranges, I would assume that the "knock" is a collection and not a sequence of ports -in other words, the order of connections to those ports does not matter.

[*] This might not be entirely accidental if this host is part of some network security challenge or a honeypot. It is highly unlikely for someone to roll-out such mechanism without bothering to test it with mainstream network/security scanning tools.


How effective is Opera Mini's encryption? Can it hide activity on a WiFi network?

First off, the service you are talking about is Opera Turbo, which the web browser, Opera Mini, makes use of.

I would imagine that network admins at a school do not care the least about what gross/weird sites you look at in your free time as long as you are not using a ton of bandwidth or breaking the law. I know that isn't your question, but it is still relevant. I'd read your university's terms of use and then not really worry about what you are looking at as long as you don't violate it.

Also, this is important to understand as there is a lot of old information out there:

  If you browse a secure site, like your bank or email, Opera Turbo stays out of the way. Your sensitive data is sent directly between your device and the secure site.

source

That means that Opera Turbo does not break end-to-end integrity. (That's a good thing!)

Quick test:

When I visit reddit.com/r/netsec, this is what Fiddler (a packet capturing tool) sees:

GET http://sitecheck2.opera.com/?host=www.reddit.com&hdn=1T%2Bc%2BVh6YJohgWpVDp9S7Q%3D%3D
200 OK (text/xml)

CONNECT http://af.opera.com:443
200 Connection Established ()

CONNECT http://autoupdate.geo.opera.com:443
200 Connection Established ()

First, it makes a request to sitecheck2.opera.com which reveals the host... and possibly the entire URL you want to visit. I think this is some kind of anti-phishing thing from Opera. In my opinion, this undermines a lot of the anonymity you are expecting to have with this solution. Then the connection to af.opera is established, and you don't see any new traffic.

I am not going to attempt to do some kind of security audit. I don't have the knowledge/skills/time to do so. The basic answer is that you don't use Opera Mini for this, you use Tor or some other SSL tunneling service. Again, this could be a clear violation of your university's Terms of Use. Even Opera Turbo could be a violation if they ban all proxy servers.


Best practices for usefully storing two factor authentication backup codes?

Use the One-Time Pad method to encrypt the codes. Then you can easily decrypt them with a pen and paper as long as you remember the key. Since the 2fa code's characters are nearly-uniform (all characters are equally likely to appear in each key position), you can use a non-uniform key such as an easy-to-remember phrase.

A bonus to encrypting your codes is you can carry multiple copies of them (one in your suitcase, one in your wallet, one on a public URL) and not worry about them getting lost or stolen.

One weakness of this is if you use the same key to use a One-Time Pad to encrypt all your 2fa backup codes and one of your codes gets brute-forced, the attacker can derive the key and then decrypt all your codes. While it is standard practice for account providers to rate-limit logins to help prevent brute-force attacks, some account providers may have worse protection than others and it should not be assumed that all account providers have adequate protection. Your 2fa backup code security is then only as good as the weakest account provider. Therefore, you should use a different key for each account which negates one of the major benefits of this method: that you only have to memorize one key.

On the uniformity of 2FA codes

When using One-Time Pads (OTP) to encrypt a sentence, the key must be uniform to guard against frequency analysis. But in general, either the plaintext or the key need to be uniform. Google Authenticator and other 2fa providers use a hash generated by SHA-1 to generate the 2fa codes which is the standard for HOTP (RFC4226) and TOTP (RFC6238). While SHA-1 may not be perfectly uniform, SHA-1 is nearly-uniform and close enough to uniform that frequency analysis is not a feasible attack. Therefore, any non-obvious key such as an easy-to-remember phrase or sentence can be used to encrypt the 2fa codes.


Apache Partial HTTP Request Denial of Service Vulnerability

This is the slow loris attack of incomplete HTTP GET Requests.

How to protect your server: Update your Apache Server, there are many updates for this attack, this attack was discovered in like 2011. Other options are to reduce timeout on your Apache Server, etc. This attack works on timeout. Here tells you how to protect your Apache from DoS/DDoS (slow loris included) on Linux (provides updates, shows settings to be changed).

What is the slow loris? The slow loris is a layer 7 Denial of Server (DoS, can be carried out with 1 computer) that is used widely on Apache servers and more, because these servers if not updated have this "bug".

How does the slow loris work? The slow loris is done by a TCP connection being made, and then an incomplete HTTP GET request is sent to the server. The server then does not timeout this connection for long periods of time as high as 400 seconds. The server (such as Apache server's) do this because the idea is, it thinks you are on some untrusted network, or simply slow internet and will wait for the rest of the HTTP GET Request.

More Information: This is an HTTP DoS not a TCP DoS because the request is what is causing this. A slow loris attack can work at sending 1 packet per second for each new connection.

Examples of how this request looks like:

GET / HTTP/1.1\r\nHost: www.whatever.com\r\nUser-Agent: Mozilla 5.0\r\n

or

GET / HTTP/1.1\r\nHost: www.whatever.com\r\nUser-Agent: Mozilla 5.0

Example of normal HTTP GET Request:

GET / HTTP/1.1\r\nHost: www.whatever.com\r\nUser-Agent: Mozilla 5.0\r\n\r\n


Why iterate 5200 times when computing Safety Numbers in Signal?

The comment isn't explained very well, but I believe I've determined the math behind it. The safety number is 60 base 10 digits, but it's created in two 30 digit halves: one based on your phone number and public key, and one based on the phone number and public key of the person you're talking to.

Assuming a high entropy value is converted into a 30 digit number without unnecessary loss of entropy, it will contain log2(1030) ≈ 99.66 bits of entropy, equating to 99.66 "bits of security" (meaning an attacker would have a 50% chance of matching that safety number after 299.66/2 = 298.66 hashes). Iterating many times increases the bits of security (since it increases the number of hash operations for each try the attacker makes):

log2(1030 × 1024) ≈ 109.66

log2(1030 × 1400) ≈ 110.11

log2(1030 × 5200) ≈ 112.00

This is for how many hashes an attacker would have to perform to match a specific security number, but if the attacker wanted to be able to read the messages you send them, they'd need to know the private key that matches the public key they used in the hash. Generating RSA keypairs is computationally expensive, but ECC is much faster. If the keypair generation is fast enough, it makes sense to iterate the hash to increase the lower bound of an attack on a safety number.


Getting a PHISH/Zmate.omna detection by Avira when I refresh my page, but online website scanners are showing that the page is clean

Checking the designate website will not help very much if it is a malvertisement(Malware advertisement) campaign coming from third party javascript inside the web page.

You should check the AV report to see whether it capture URL that download the phishing contents.  That will tell you which URL is really the culprits.


Is this Ubuntu server configuration secure?

Firewall does not shield services that need to be accessible from the network.

Is this a VM or a container VPS? If it's a container based VPS (done using OpenVZ or vserver), then you are quite limited in what you can do to improve security. If it's a VM, you can install a kernel patched with Grsecurity and use a MAC solution like TOMOYO, AppArmor or SELinux to isolate your services.

With passwordless login I presume you use keys? Also you need to learn more about the services you are running that are exposed to the network (nginx and ssh). Learn configuration files and what options you have.

Read man pages for config files. Certain configuration options (and combinations of) can lead to a vulnerable system.

Your system will always be insecure until you (admin) know your system, dangers and security mechanisms at your disposal.


What are the dangers of allowing "less secure apps" to access my Google account?

In my understanding, "less secure apps" refers to applications that send your credentials directly to Gmail. Lots of things can go wrong when you give your credentials to third party to give to the authentication authority: the third party might keep the credentials in storage without telling you, they might use your credentials for purposes outside the stated scope of the application, they might send your credentials over a network without encryption, etc.

Additionally, it could be an app that a user has installed locally such as an IMAP client (see the following support note from google: https://support.google.com/accounts/answer/6010255?hl=en)

"Less secure" isn't meant to say that apps that use your credentials are necessarily full of security holes or run by criminals. Rather, it is the category of behavior -- giving your credentials to a third party -- that is fundamentally less secure than using an authorization mechanism like OAuth. With authorization, you never allow the third party to see your credentials, so an entire category of problems are instantly eliminated.

In OAuth, you authenticate directly to Gmail with your credentials and authorize an app to do certain things. The third-party app only sees an authorization token provided by Google as proof that you authenticated correctly and agreed to authorize that app.

As for why it would be dangerous to enable less secure apps (versus using a particular app that may be untrustworthy), I'm not totally sure. Google's refusal to authenticate happens after you've already given away your credentials to the application. It seems to me that any time you provide your credentials to a third party, it doesn't matter whether or not you've allowed authentication by "less secure apps" -- someone can just load up a log-in screen and directly log in as you. The only possible cases I can think of are:

Possibly "app-based" login attempts are treated differently from "human-based" login attempts, in particular how they treat sudden changes in location. Maybe the "less secure" app you're trying to use has servers on another continent, so it's not suspicious to Gmail when an app tries to log in as you somewhere else, while an attempt to use the log in screen from another continent by a human would be suspicious.
Possibly "less secure" auth methods include some other login method that doesn't directly reveal your credentials to the third-party but are less secure than OAuth 2.0 in some other way (e.g., they're vulnerable to eavesdropping by an attacker, or they make it somehow easier for an attacker to access your account without knowing your password).

Those two points are pure conjecture and very well may not be true in actual fact.


What is the security measure that prevents me from posting using script and I must use browser to execute HTTP POSTs successfully

Typically such failures are caused by

Bugs in your program.
The site requiring Javascript which your python program probably does not handle.
Or the detection of non-browser user-agents on the site.

The most common cases are probably 1. and 2. (which are unrelated to information security) while 3. might be employed by sites which explicitly forbid automatic submissions or have special API's for this in place.


Single point of failure: can US government requests for passwords be a vector for attack?

Impersonating law enforcement agents is an old trick used by criminals to fool honest people. This is a mechanism used in numerous movies, e.g. this one.

Though it has been revealed that the US government requested (and presumably obtained) some user password dumps from Internet companies, the exact details of the used protocols for that exchange are not known. We can imagine that it involved a face-to-face meeting with some government agents, probably in a discreet way (the whole operation was supposed to be secret, so no warrant or uniformed officers), but the responsible people at the target Internet companies were somehow convinced that they were talking to genuine US agents.

If I were in the position of the government agency officer trying to setup this interception, I would first invite the ISP CEO to meet me in a very official-looking building, say the Pentagon or the CIA headquarters at Langley. The guy would then see me and be convinced that I really am an official member of the hidden US forces, by virtue of me being able to secure an office in the main CIA building. Then, I could later meet the guy again, at his office, and he would recognize me and accept to hand me a fresh batch of passwords.

The important point in all this is that the vulnerability is not the US government; it is that ISP are apparently willing to hand passwords over to someone who could convince them that he operates under a direct mandate of the US government. The vulnerability would still be there even if the US government had never been involved at all !

Another attack vector is afterwards. Assume that a real government agent obtained the passwords. Then he will store them. Somewhere. Will they be well protected there ? US taxpayers certainly hope that expensive intelligence agencies are competent and won't store sensitive data on hackable servers. But can they be sure of that ?


For untrusted user upload sites: what should the contents of crossdomain.xml and clientaccesspolicy.xml be?

With regard to Flash issues, every site that doesn't use Flash should use one of the two files at the root of the web server named crossdomain.xml.  This will prevent XSS via that plugin

<?xml version="1.0"?>
<!DOCTYPE cross-domain-policy SYSTEM
 "http://www.adobe.com/xml/dtds/cross-domain-policy.dtd">

<cross-domain-policy xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="http://www.adobe.com/xml/schemas/PolicyFile.xsd">
  <site-control permitted-cross-domain-policies="master-only"/>
</cross-domain-policy>

The "Master Only" directive prevents any other file from being read, even if they have the correct content type.  The MIME type of this file should be text/x-cross-domain-policy


Where do suspect requests from logged-in users to my website come from?

The list of URLs you're seeing looks similar to ones produced by tools like nikto which request list of potentially vulnerable or known URLs.  Of course a list like this could (and likely is) usuable by malware as well as testing tools like nikto.

One interesting factor in tracing what's doing this would be, what's the user agent on these requests? Many testing tools will have a custom user agent so that they're activity can be detected, while malware will likely try and make it look like a standard users browser string to be less noticable.

Either way it would be more difficult for the tool to completely match the real user browser string, so matching users "usual" user agents with odd requests which appear to come from that user could help you work out what's going on.


Can ICMP Redirects still be used to redirect traffic in a LAN?

ICMP redirects have been disabled in many Windows XP and Windows Server 2003 environments since the introduction of the first service packs. You might find it in legacy Windows infrastructures, but I doubt you will find it in Vista-era or later.

To detect whether or not ICMP redirects will work on any given network, use the Responder.py tool in "Analyze Mode" as seen in the fifth section of this blog post -- https://www.trustwave.com/Resources/SpiderLabs-Blog/Responder-2-0---Owning-Windows-Networks-part-3/

Best would be to use a tool such as EvilFOCA, or to see this other StackExchange post on using dns2proxy with sslstrip2. Many of these techniques will provide MITM conditions.


How to get informed in metasploit when a user does a reverse shell to my computer

Yes it is possible have a look at http://www.digininja.org/metasploit/session_created.php it explains how to do it!

Also useful http://seclists.org/metasploit/2010/q1/87

Relevant excerpt from the links in case they ever go down:

  A version of this has been added to trunk, just svn update /
  msfupdate:

msf> load sounds

  You can create your own "theme" by copying data/sounds/default/ to
  data/sounds/mytheme, modifying the files, and then loading the plugin
  with:

msf> load sounds theme=mytheme

  I haven't tried the Windows version but from what I've read it should
  work and most people will have the required gem installed by default.
  If you don't you can install it with:

gem install win32-sound


Yes, We can create FAKE AP but with same ESSID or BSSID as legitimate one. Thus if our signal strength is higher victim will connect to FAKE AP. For ex We can duplicate the AP-HOME and with same MAC address that AP-HOME has.
If AP-HOME is off, and we create fake AP with ESSID AP-HOME, client will automatically connect to us.
we can set up wifi bridge between authorized network and Rougue-AP, and in this case if Victim connects to Rougue-AP he will have access to internet via Wifi-Bridge.
Well, the simplest way but the most hardest trick is to show victim a webpage which will automatically download a virus on client's PC. Ever visited a malicious site that automatically delivered virus on your machine. This way client will no necessarily download virus but will get infected.

Some things in question were unclear, I hope this will help


Besides MBR & BIOS, is it possible for a rootkit to stay persistent after a format of the hard drive?

Normally, no. Not in a self-bootable area. You might have data not overwritten by the disk wipe, in "out-of-band" areas, but those areas aren't normally accessible, and if made so, they also become accessible to the wipe.

Theoretically, for very large values of theoretically, yes. In some hard drives, there may be a third memory area that is accessible, self-booting and capable of hosting a complex malware (as complex as, say, a minimal Linux kernel).

(Update: the above trick has been reported in the wild by Kaspersky)

This area is normally not accessed (for programming) through the data cable by which the hard drive is connected to the host computer, but through a specialized JTAG connector which is only used during the manufacturing process.

Also, the programming instructions must be specifically adapted for the hard drive controller CPU chip; just as the same HTTP protocol may be "spoken" by a Motorola-powered old Mac or an Intel 80386, but the two CPUs won't ever "speak" the same language, so two disks from the same manufacturer may have an Avago chip, or a Marvell one - and they will require different and totally incompatible instructions.

The problem then is that the malware would have to be specifically targeted, and in most if not all cases, hardware physical access to the JTAG connector through a custom cable will be required. So a purely software malware would have no chances. Unless some programming backdoor had been burned in the firmware by the manufacturer, in order to save some bucks and do without the whole JTAG stuff. Which, predictably, it seems to have been the case.

A disk thus hacked is completely untrustworthy. Whatever you do to a hard disk from the SATA cable is actually no more than a polite request to the disk SoC to perform some action on your behalf. Untampered SoCs will obey (or lie to you to your advantage: for example reporting that a sector has been written instantly, while in reality it is being held in a write-back cache to increase performances). A tampered SoC might disobey and lie about it (and will do so, or there would no point in tampering).

You could (ask it to) overwrite the boot loader, read it back and receive an enthusiastic confirmation that it has been zeroed; (ask to) write a clean boot loader in its place, re-read it and receive a haughty confirmation that it has been written and committed. Then power cycle... and still have a malicious boot loader come out of the disk instead of the one you believed should have been there, thus bluepilling the system.

Of course, the malware should be aware of the operating system in use in order to infect it, and gain, through it, a more sophisticated access to files, network, keyboard and so on. It would do so by intercepting the operating system attempts to load its own code from disk, supplying instead modified code containing the infection routines. The modified code would need to be compatible with the operating system, and it would be powerless should the operating system self-check its own code, unless even more advanced techniques were used.

Actual probability is in the low noughts for any reasonably common scenario.

On the other hand... if you just received a brand new desktop as a token of NSA's appreciation for your work, then no - wiping the disk, zeroing its HPA and DCO and Gutmann-blasting every single sector it has, will not be enough.


Seeking lightweight encryption - shareable between Delphi & C

Symmetric-key encryption is very light weight,  I am not sure why memory/cpu this would be a concern, even on a cheap micro-controller.  Perhaps 30 years ago this was a worry,  but not in twenty-twelve.

I like AES-128 in CCM mode with a random IV.  If you don't know what that means, you probably shouldn't be implementing a crypto system. Encryption isn't some magic wand that protects you from attack,  a lot can go wrong.  Good cryptographers are hard to come by.


While the Diceware passphrase generation system is sound, you aren't the first person to express concerns about the default wordlist.  The nice thing is that you can create your own wordlist that works with Arnold's system.  That gives you flexibility in eliminating offensive words and replacing words deemed too short or obscure.

In fact, several organizations have already created their own word lists for use with Diceware.  The most recent was Joseph Bonneau's work for the EFF to develop several wordlist variations that focus on improving usability of the resulting passphrases.  This is really great work and is the first place I'd point you when considering an alternative to the default wordlist.

As far as the possibility of generating short passphrases with the original word list, I estimated that 0.00037% of possible 5 word combinations would be eliminated if you rejected anything shorter than 14 characters (assuming spaces separate words).  So while it's not ideal to reduce overall system entropy, this has a very small impact on security.

Arnold also recommends separating words with spaces, so that should pad even a 6 word passphrase composed of single letter words to 11 characters.


Multiple login attempts made using mobile OTP in multiple customer sites at the same time

1.Which type of attack this is ? and how it is possible ?
Attack could be a dictionary attack or Brute-force guessing attack. There are many scripts available publicly to perform those kind of attacks. Even an expert can develop their own script as well. In addition to that botnet attack also possible.
2.How to understand whether those OTP were used for login & collect information ?
It is only possible if you have setup proper logs and monitoring solution. OTP in mainly two types. Synchronous and asynchronous. Synchronous OTPs are not working after specific time period and asynchronous OTPs are available until it use. But according to your scenario, synchronous should be used and If logs and monitoring are not enabled, unable to check whether those are used or not.
3.How we can prevent this?
You need to enable firewall/IPS and especially Input validation and clipping levels for failure login attempts. Monitoring is required at any situation, Otherwise you don't have visibility on what is going on with network.


Also when testing for configuration issues I would set exitonsession to true.

if you are using your web browser to deliver the payload it can continue to run cycles until fails over.

setting the exitonsession will slow things down for you a bit, and stop creating so many sessions.


Removing files from drive while encrypting with Bitlocker

It is not just data we need to think about - but also the file system and the metadata associated with the files as well as the file system.

If ( a big IF ) we can determine for sure that BitLocker has only encrypted the free space so far (skipping all else), then the question you asked becomes at least a theoretical possibility (still depends on how BitLocker code is written - whether it detects changes to disk after it starts encryption, and how it handles such changes).

In general, file system data is not only stored at the beginning but also some redundant copies are stored in other places.

We must assume that BitLocker has already encrypted such metadata - and any changes you make to the file system (such as deleting files) changes the already encrypted data (including free blocks, number of files, directories, etc).

So my answer is NO. You're much better off stopping the encryption altogether; doing whatever housekeeping you want to do and then restarting afresh.