Smart cards and the behaviour of the browser. Is the PIN cached? When using smart cards for certificate-based authentication, is the PIN entered by the user to authenticate his smart card to the browser is cached? OR does the certificate gets cached by the browser? OR is it both?.

What are the differences in the behaviour of the browser between typical certificate authentication (certificate is imported to the browser) vs. certificate authentication via a smart card?

This is very similar to the question I want answers to, but it is unanswered. Does Chrome cache smartcard PIN?

Assuming you use windows.

The PIN is cached to avoid having to re-enter it. The certificate is on the smart card and cannot be cached as the pin is used to unlock it.
I don't think Chrome can cache the pin as it's handled by the credential providers and not the application itself.

Relevant info from https://docs.microsoft.com/en-us/windows/security/identity-protection/smart-cards/smart-card-architecture#pin-caching:

  PIN caching

  The PIN cache protects the user from entering a PIN every time the
  smart card is unauthenticated. After a smart card is authenticated, it
  will not differentiate among host-side applications—any application
  can access private data on the smart card.

  To mitigate this, the smart card enters an exclusive state when an
  application authenticates to the smart card. However, this means that
  other applications cannot communicate with the smart card and will be
  blocked. Therefore, such exclusive connections are minimized. The
  issue is that a protocol (such as the Kerberos protocol) requires
  multiple signing operations. Therefore, the protocol requires
  exclusive access to the smart card over an extended period, or it
  require multiple authentication operations. This is where the PIN
  cache is used to minimize exclusive use of the smart card without
  forcing the user to enter a PIN multiple times.

  The following example illustrates how this works. In this scenario,
  there are two applications: Outlook and Internet Explorer. The
  applications use smart cards for different purposes.

  The user starts Outlook and tries to send a signed e-mail. The private key is on the smart card.
  Outlook prompts the user for the smart card PIN. The user enters the correct PIN.
  E-mail data is sent to the smart card for the signature operation. The Outlook client formats the response and sends the e-mail.
  The user opens Internet Explorer and tries to access a protected site that requires Transport Layer Security (TLS) authentication for
  the client.
  Internet Explorer prompts the user for the smart card PIN. The user enters the correct PIN.
  The TLS-related private key operation occurs on the smart card, and the user is authenticated and signed in.
  The user returns to Outlook to send another signed e-mail. This time, the user is not prompted for a PIN because the PIN is cached
  from the previous operation. Similarly, if the user uses Internet
  Explorer again for another operation, Internet Explorer will not
  prompt the user for a PIN.

  The Base CSP internally maintains a per-process cache of the PIN. The
  PIN is encrypted and stored in memory. The functions that are used to
  secure the PIN are RtlEncryptMemory, RtlDecryptMemory, and
  RtlSecureZeroMemory, which will empty buffers that contained the PIN.


Risks of a PHP image upload form My client wants a photography site where users can upload their photos in response to photography competitions. Though technically this isn't a problem, I want to know the risks associated with allowing any user to upload any image onto my server. I've got the feeling the risks are high...

I was thinking of using something like this http://www.w3schools.com/php/php_file_upload.asp

If I do let anonymous users upload files, how can I secure the directory into which the images (and potentially malicious files) will be uploaded?

The biggest concern is obviously that malicious users will upload things that are not images to your server. Specifically they might upload executable files or scripts which they will attempt to trick your server into executing.

One way to protect against this is to make sure that the files are not executable after you move_uploaded_file in PHP. This is as simple as using chmod() to set 644 permissions.

Note that a user can still upload PHP scripts or other scripts and trick Apache into executing them depending on your configuration.

To avoid this, call getimagesize() on the files after they are uploaded and determine what file type they are. Rename the files to a unique filename and use your own extension. That way, if a user uploads evil.jpg.php, your script will save that as 12345.jpg and it won't be executable. Better yet, your script will not even touch it as it will be an invalid JPEG.

I personally always rename uploaded images to either the current timestamp from time() or a UUID. This also helps prevent against very evil filenames (like someone trying to upload a file they've named ../../../../../../../../etc/passwd)

As further protection you can use what's sometimes known as an "Image Firewall". Basically this involves saving uploaded images to a directory which is outside the Document Root and displaying them via a PHP script which calls readfile() to display them. This might be a lot of work but is the safest option.

A secondary concern is users uploading too many files or files which are too large, consuming all the disk space available or filling the hosting user's quota. This can be managed within your software, including limiting the size of individual files, the amount of data one user can upload, the total size of all uploads, etc. Make sure the website admin user has a way to manage and delete these files.

Do not rely on any of the data in $_FILES. Many sites tell you to check the mime type of the file, either from $_FILES[0]['type'] or by checking the filename's extension. Do not do this. Everything under $_FILES with the exception of tmp_name can be manipulated by a malicious user. If you know you want images only call getimagesize as it actually reads image data and will know if the file is really an image.

Do not rely on checking the HTTP Referrer for any security. Many sites advise you to check to make sure that the referrer is your own site to ensure that the file is legitimate. This can easily be faked.

For further information, here are some good articles:

http://software-security.sans.org/blog/2009/12/28/8-basic-rules-to-implement-secure-file-uploads/
http://nullcandy.com/php-image-upload-security-how-not-to-do-it/
http://www.acunetix.com/websitesecurity/upload-forms-threat/
http://josephkeeler.com/2009/04/php-upload-security-the-1x1-jpeg-hack/


Are NTFS Alternate File Streams considered a security risk in your organisation; how is it mitigated? Alternate File Streams allows a user to embed hidden content within any NTFS file.  That file can be a TXT file, or MOV for example.  Some may consider this a form of steganography, and therefore the same auditing principals may apply.  On the other hand, some applications such as Exchange and SMTP uses these streams extensively for legitimate purposes.

Do Alternate File Streams get any special treatment within your organisation?

What are the main reasons you would, or would not audit AFS file access?

If you scan for these files explicitly, what do you look for?  How do you respond?

I have spoken with folks in a lot of corporates, and the majority are not looking at Alternate File Streams at all. The reason being in all cases that they have far simpler channels that still need to be controlled effectively and no extra budget. One client with a very effective DLP solution disallows any outgoing files or attachments, unless they have been preapproved - so they would be my best candidate to try this, however they don't have the infrastructure to easily implement this.

A problem is that you would need to automate the validity of AFS content - I don't know of anyone who has a solution yet. I guess you could whitelist all the apps that have a valid reason, but then a savvy individual could just use AFS in files associated with these apps.

The more I think about it and compare with other DLP attempts, the more I think it is a major issue unless you migrate extensively to thin clients (eg a fully Citrix'ed environment) or have an environment so locked down users can't get enough access to create AFS.


How do I configure Terminal Server (and clients) for use over untrusted Wifi networks? Suppose a client wants to directly connect to Terminal Server exposed to the Internet, without a VPN, ... what software & settings is needed to properly protect against WiFi based attacks?  (assume MITM is possible, and multiple client platforms are permitted)

Background Information

VPN-less RDP is common not only in branch offices, but is also frequently used with cloud-hosted servers.  Given that RDP is the default mechanism to administer IaaS and PaaS solutions I'm trying to estimate the probility that an untrained administrator may connect to these hosts without the necessary security controls in place.

I'm interested in information on how to properly configure a server and any additional software required for a PC, OSX, and possibly Linux.

The old versions of RDP can do some encryption, but it is vulnerable to Man-in-the-Middle attacks for lack of validation of the server public key (older versions used weak encryption as well, or even no encryption at all except for the password sending).

Beginning with version 5.2 of the protocol, SSL/TLS can be used (the TLS traffic is encapsulated in the RDP-specific transport protocol), thus with a server certificate which the client can validate; this gives the needed protection against attackers, including MitM. The server must be Windows Server 2003 or more recent; as a RDP server, Windows XP cannot do that. However, the RDP client which comes with WinXP SP3 knows this protocol and can use it.

An alternative is Terminal Service Gateway, which is an extra service which reverts the structure: an SSL/TLS connection, on port 443, and inside it the RDP protocol. The TSG must be Windows 2008 or more recent. There again, the client in WinXP SP3 can use that.

Unfortunately, alternative clients for other operating systems, like rdesktop, do not support RDP 5.2 or TSG yet (if they do, I would love to hear about it). The Microsoft client exists for MacOS X (it comes with Office, it might be downloadable separately) but not for Linux. For proper security of RDP with multi-platform support, you will need a VPN.


How can I snoop on a mutually authenticated SSL connection? Our company connects to an external service through an outdated library (using a PHP extension for an older version of PHP). As this requires us to have a server setup in isolation for this service, I have reached out to the company to ask if there is any chance of a newer version of their extension but unfortunately not at this stage.

The extension uses a known and shared client certificate (for all clients) with a different certificate password per client.

I am interested to see how the protocol works so that we could potentially develop our own library for it using modern technologies, however due to the mutual authentication I am not sure how to go about snooping on the traffic.

For argument's sake, let's say that the service we are connecting to is example.com (note that the server is also SSL authenticated). If we have been given a shared client certificate and a client-specific password, is it possible to snoop on this traffic, and how could we do this?

The extension specifically requires a Linux OS, so where possible, it would be very helpful if the solution or suggestions could be tailored to that environment.

You may want to take a look to ReverseEngineering.SE as there may be some more practical information there. I also recommend you to check your product license and get some legal advise: while reverse engineering is usually considered a fair practice (from a legal perspective) when it comes to ensuring software compatibility, it is often a grey area and you may not want to put yourself or your company into trouble.

Your application is using SSL mutual authentication, which means that the server authenticate itself to the client, the client authenticate itself to the server, and the communication between both is ciphered.

What you need is called SSL interception.

This is basically done using some form of proxy which will fake server's identity to the client, fake client's identity to the server, and have access to the communication in clear form in between.

Normal communication:

CLIENT >client_cert>---------------------------------<server_cert< SERVER

Communication intercepted by a proxy:

CLIENT >client_cert>------<fake_server_cert< PROXY >client_cert>------<server_cert< SERVER

Fake server's identity to the client

This is usually done by installing a CA certificate you control (ie. one you created yourself and for which you have the associated private key) on the client.

Then install this CA certificate on the proxy with the associated private key. Now any certificate that the proxy will generate and sign using this CA will be trusted by the client. In particular, the proxy will be able to generate new certificates bearing the genuine server name, effectively spoofing its identity.

Note that there are measures that the client can take to detect that the certificate sent by the proxy is not the actual server's certificate, but if you are lucky (ie. if the developers did not take any specific step to harden their application) such measure will not be implemented.

Fake client identity to the server

As you have no control over the server, you therefore need a genuine client certificate with its associated private key. Fortunately, according to your post it seems that you have them, so it should be possible to install one of these client certificates on the proxy to make it able to identify itself as a genuine client against the remote server.


Is it good practice to SHA512 passwords prior to passing them to bcrypt? I want to allow any-sized passwords to be allowed to be submitted.  I currently use bcrypt as a key derivation function for passwords, however I have realized that it has a maximum input length of 72.

Because of this, I would like to sha512 passwords before passing them to bcrypt, allowing any-sized passwords to register, because it's my understanding that sha512 outputs 64 bytes.

Is this OK practice?  I've heard that mixing and matching hashes, or "creating your own crypto" is bad practice, but this seems like a viable workaround to the hard limit.

Thanks.

Hashing passwords with a decent, secure hash function before pushing them into bcrypt is a reasonable and secure way to keep all the goodness of bcrypt, and additionally support passwords of arbitrary size.

You still want to exercise caution about some practical details. In particular, many bcrypt implementations expect a password, i.e. a sequence of characters, terminating with the first byte of value 0x00. The output of SHA-512 is binary and thus may contain some bytes of value 0x00. For instance, 1/256th of all passwords will yield a hash value which begins with a byte of value 0x00, that a string-based bcrypt instance will understand as equivalent to an empty password. This is not good...

The solution is to use a deterministic bytes-to-characters encoding, e.g. Base64. Since this implies some size extension, SHA-512 will no longer be adequate (Base64 turns 64 bytes into 88 characters, more than the 72 limit of bcrypt). Therefore, use SHA-256: the 256-bit output (32 bytes) will be encoded by Base64 into 44 characters, and that will be fine with bcrypt.

(The 512-bit output size of SHA-512 is utter overkill anyway. SHA-256 is good enough.)


Host filesystem manipulation from docker vs. virtual machine When reading about docker, I found a part of the documentation describing the attack surface of the docker daemon. From what I was able to understand, part of the argument is that it is possible to share (basically arbitrary) parts of the host filesystem with the container, which can then be manipulated by a privileged user in the container. This seems to be used as an argument against granting unprivileged users direct access to the docker daemon (see also this Security SE answer).
Would the same be possible from a virtual machine, e.g. in VirtualBox, which on the host is run as an unprivileged user?
A quick test where I was trying to read /etc/sudoers on a Linux Host from a Linux guest running in VirtualBox did produce a permission error (using sudo cat /path/to/shared/etc/sudoers as well as with sudo su, followed by cat /path/to/shared/etc/sudoers), but I would not consider myself an expert in that regard in any way nor was the testing very exhaustive.

It's perfectly possible, with virtualization systems, to expose the underlying host OS filesystem (assuming here we're talking about Hypervisors running on a general purpose OS and not a "bare metal" setup), how that's done depends on the hypervisor in question.
That said container systems, like Docker, are more likely to have issues with this as, whilst most VMs can operate perfectly happily with just the resources available in the guest, containers will often mount host directories in to provide persistent storage.
Where that gets somewhat more dangerous, in many container setups, is that contained processes often run as the root user, which is the same UID as root on the host (assuming user namespacing isn't enabled).
In that configuration, if a sensitive host path is mapped inside the container, it would be easy for an attacker who has gained access to the container to modify the files on the host.


phpBB under nginx, htaccess protection is lost – what are the risks? I'm running phpBB 3.1 on a server that uses nginx not Apache, and due to this, none of the phpBB .htaccess files work, and so files in the document root that are normally protected under Apache, are actually served up by nginx.

Theme cfg file:

/styles/prosilver/style.cfg

All YML files in /config such as /config/auth.yml

Composer files:

/composer.lock
/composer.json
/phpbb/composer.json
/vendor/composer/installed.json

Cache files (but looks empty):

/data_cron.lock_check.php.lock

Also a .htaccess blocks /common.php and /config.php. config.php contains the database credentials but only sets variables – no output. common.php has code but doesn't seem to be a security risk.

I haven't configured nginx to block access to these and I would like to ask if there is any specific vulnerability due to these files being exposed to the public?

I know it is good practice to prevent access to anything that the public doesn't need, but what are the concrete risks here?

So far I've come up with these but I wouldn't say they're concrete risks:

The theme cfg files exposes the phpBB version, which could lead an attacker to find out what bugs are in that version.
If PHP somehow became disabled then /config.php could be served up, giving the database credentials.

Anything  better than these?

There is also a config file for NGINX which should protect these files:

https://github.com/phpbb/phpbb/blob/3.1.x/phpBB/docs/nginx.sample.conf

# Deny access to internal phpbb files.
        location ~ /(config\.php|common\.php|includes|cache|files|store|images/avatars/upload) {
            deny all;
            # deny was ignored before 0.8.40 for connections over IPv6.
            # Use internal directive to prohibit access on older versions.
            internal;
        }

If people can access / retrieve the contents of the files, they may get your database credentials and other critical data.


What happens when your secret API key is stolen and used by others? The use of paid API is increasingly rising each year. For example, IBM, Google and Microsoft are providing paid API such as Text to Speech, Speech to Text and Image to Text and vice versa.

I have a question about what happens If I build an app and publish it:

1.What happens when another person use Wireshack or reverse engineering to  obtain the key of this API and then use it in their app or sell it?

2.Will I be paying for this even though my clients are not the people using this API?

3.Is there a way to reduce or prevent this from happening?

I am just worried about this and sure this is happening or must have happened at some point.

NOTE:

I asked this because I saw my Google Map API with the Wireshark software.

My initial solution is to make each user create username and password and apply  restrictions to each individual user but those companies I mentioned up don't do that. They simply use one single key for their services.

As you may expect it, there is no way to fully protect your api key
if it is directly used by a client application. The user can sniff his
netowrk (the use of https or of an encrypted channel might still
help but is only a matter of time as the user can see the full
handshake) or reverse engeneering the software (same here, you can
encrypt the api key but with some work, you can always get the key
back).
Yes, you will still get charged even if the api key is not used accordingly to what you may expect simply because the api service has no way to know if it is some of your intented use.
There is only one solution which can fully secure your api key from being grabbed and used as not intended : do everything with the api key server side. Your server will act as proxy between the client application and the api service and thus, the client can't be aware of the api key. Howewer, it may cost you additional cost to set up a server.


How to deal with a company that doesn't fix (potential) security vulnerabilities in their web app? About 2 weeks ago, I stumbled across a web application, that can be used by gyms to manage the information about their members. This includes data like the name, billing address, birth date, and medical history. The gym I am visiting (in Europe) is also using this application and so I took a closer look at the application. I didn't dig very deep to avoid legal issues, but these are some of the "problems" I found:

The login allows infinite tries
The JSON response from the backend includes information whether the username or password was incorrect
The user password is stored in the local storage in plain text
There is an unrestricted file upload for profile pictures
An old PHP version is used
There are multiple backends that throw exceptions (this way I could find out which PHP framework they are using)
Session IDs can be overwritten (Session fixation)
It seems like there is no input validation. They are using React, so XSS is not as easy but still possible

All of these don't seem like super-critical to me, unless someone really takes their time and tries to exploit these potential vulnerabilities. From what I can tell, there are least 20,000 customers stored in their database. Also it seems like all the customer data is stored in one big table for all the different gyms that are using this application.

The kind of data that is stored about the customers seems to be very personal and shouldn't be in the wrong hands I guess. So I contacted this company anonymously and told them about my concerns. They responded to me a few days ago and said that they fixed everything - however I checked it and basically nothing changed in this web application (still the same vulnerabilities).

So here is my question: How should I proceed? Should I give them a second chance or contact some kind of data protection authority? And would you consider these problems/vulnerabilities critical? (like already said: I didn't dig too deep, but even with my limited security knowledge I think I could get most of the user data into my hands within a few days)

Should I give them a second chance

Yes. It is typical to wait several months and communicate several times with the developing company before taking any further action.

If the company has shown that it is not willing to fix the issue, a possible next step is to publicly disclose the issue.

  or contact some kind of data protection authority?

This is a good idea. I don't have experience with this, but you could at least inform such an authority what you found and are discussing next steps with the company.

  And would you consider these problems/vulnerabilites critical?

No, but it shows that they haven't done anything to secure their systems, so it is likely that there are more serious vulnerabilities.


How to protect against brute forcing How do you properly implement defenses against brute forcing? Is it best to store how many times someone tried to log in and block them after X attempts? And how would "someone" be identified? With the session? An IP?

The answer to denying brute force is to deny a large number of attempts, where large is defined by your key space and risk acceptance.

Each situation is going to have different solutions.

Meat Space

Doors are reinforced against brute force damage.
Crashing through a door is mitigated by chance of alerting the police.
Keys only have around 5 variables, but it takes resources to have one of each key (easier to attack the lock in other ways that aren't brute force)

Computers

Automating brute force attacks means you need to rate-limit in some way.  With a rate-limit, you can absolutely know your upper band of attempts over a certain amount of time.
Monitoring:  If you can limit brute force attempts to a certain rate (500 / day perhaps), then monitoring and alerting can let a person know to take a closer look at what is going on.  How many attempts will it take to reach a certain level of unacceptable risk?
Large Key space:  Having complex password requirements can greatly increase the number of attempts required for a certain probability of finding the password.
Two factor authentication: brute forcing the password isn't enough in this case

All of the solutions also have trade-offs like everything else in life.

Rate limiting: can DoS legitimate users, not effective if attack is breadth first - one attempt for each account before trying a 2nd time
Rate limiting by IP: Not effective if it is a distributed attack
Password complexity:  Is usually a tradeoff in usability meaning users will write down their passwords - decreasing security by a greater amount than the brute force threat
Two Factor: might be seen as expensive, can lose tokens


What security implications are there when sending video feed over unknown applications, and how can we protect ourselves? This might sound broad -- but it has to be considering the details are truly unknown.

Context: Our university (and many more) have begun rolling out mandatory webcam recording for certain portions of the course. This has been sprung on us mid course (and we have no exit option; we must either comply with some of these records examinations/assignments or now fail the course.)

We have been presented with no transparency reports, retention times, constitution of who will handle the data except "administration" or details on how the data will be transmitted.

It's seemingly sound the universities want to protect academic integrity -- but I feel like the amount of data with very little policy being distributed is concerning.

Probing, hacking, debugging or touching the software is grounds for academic misconduct, as it would be counted as tampering.

So, at worst: what should us students worry about with our data? It seems obvious the data could leak. How can we keep ourselves safe and our privacy the best we can given the abysmal circumstances?

(It's worth noting but off-topic that many students do not care about this.)

So I am not exactly I sure I understand the question because you mention this video feed is over unknown applications.  So this is what I think is happening and sorry if I get it wrong.  The University wants you to video yourself taking tests and working one certain material.  This feed should be sent out through a known application, although it may not be known to you, to the University in order to ensure your roommate was not typing in the work.

There are always security concerns, however taking proper precautions should be fine.  For instance I have heard of hackers using a web cam to spy on people however in order to do this they need the physical device connected and when I had to do the same as you for online tests I would connect it, all other times I would disconnect it.

It is important to realize however that if someone has control of your web cam there is a good chance they have control of your computer.

As far as sending the video to the University there probably should not be any sensitive information going to the University, well anything anyone but the University would want.


32-Bit Windows Position Independent shellcode variables In position independent shellcode for 32-Bit windows what are the most commonly used techniques for storing string variables. I've been using stack based strings:

Adjust the ESP register
Store the ESP value in EBP
Push the required DWORD strings onto the stack.
Use EQU to for the offsets names of the strings within the stack space to make life easier when using the variables later on.

My understanding is that I can't use variable definitions in the .data section as the offsets are unknown. I've tried disassembling a number of metasploit payloads to see how they work, but there don't seem to use any other techniques.

Any information about other options and their pro's and con's would be great.

Any writable location in memory that you can reference reliably. You also have to worry about corruption of these strings depending upon how many instructions are in between your write and taking control of execution.

If the exploit is remote then you cannot use envp to write a string and reference in your shell code. If it is a local exploit this may be an option.

Hopefully this is enough of a response. Exploiting some vulnerabilities takes more creativity than others.


Openssl / OpenPGP file encryption - security advise I am planning to use Openssl to encrypt our weekly offsite backups using a keyfile (symmetrical encryption) and after some research I found the following GnuPGP command:

base64 -w0 <keyfile.jpg | gpg --symmetric --passphrase-fd -0 backup.tar.gz

However this generates the following error:

gpg: Warning: using insecure memory!
gpg: Fatal: out of core in secure memory while allocating 32800 bytes

Because of that I tried using OpenSSl and have now this command:

pass=$(sha256sum keyfile.jpg | awk {'print $1'})
openssl aes-256-cbc -md sha512 -salt -a -e -in backup.tar.gz -out encrypted.tar.gz.aes -pass pass:$pass
pass=""

Is that considered to be a secure method for file encryption or was GnuPGP the better option?

Both of these schemes seem a little overly complex. Try to keep it as simple as possible, because if you ever need to actually decrypt these files, you’re probably already having a bad day cause you’re recovering from a disaster.

I’d also encourage you to use asymmetric keys with gpg for a couple of reasons:

Every message (file) gets a new and random symmetric key
99% of the guidance on the internet about gpg is based on asymmetric keys, so when you’re having that bad day, it’s going to be easier to find help.

You can also encrypt a file for multiple private key recipients with GPG, and it just encrypts the same session key repeatedly using different public keys. This is great for eliminating the “bus factor of 1” on encrypted backup files.


How do I change my IP Address after a specific number of loops in Python? I have a for loop to brute force a Gmail account. But I've heard that Gmail's max attempts is 100. So how do I change my IP after 100 loops?

Thanks in advance.

TL;TR: it is probably not possible what you want unless you add more illegal activity to your in several countries already illegal activity.

You cannot simply change your public visible IP address, at least not as log you want to have internet connectivity. If you are using DSL, cable, mobile phone etc your IP is assigned to you by the respective ISP. While it might change if you cut the connection to this ISP (i.e. reboot DSL/cable router or phone) the IP will not necessarily be different when you reconnect. In other networks like a public hotspot you only get a local IP address and even if you can change it it will not cause a change in the public visible IP address.

It might be that you have a public IPv6 address though. In this case you might try to change it using the respective OS command (i.e ip addr, ifconfig, ipconfig... - depending on your OS). But you still need to keep the same IPv6 prefix to keep connectivity and my guess is that google will just have restrictions based on prefix and not the actual IP address. And of course you would need to make your script use IPv6.

If you are in control of a botnet you can try to use it to spread the brute forcing over several IP addresses. But being in control of such a botnet is illegal in most countries.


Is that possible? A router with arpspoof from factory Just bought a 3G router from China and then checked the log:

[1970-01-01 00:00:00] The system will be restored the factory value.
[1970-01-01 00:00:00] The system current version: 1.0.5.1.
[1970-01-01 00:00:00] The system restart all services.
[1970-01-01 00:00:03] UPnP had been enabled.
[1970-01-01 00:00:03] The IP&MAC bind had been enabled.
[1970-01-01 00:00:03] arpspoof had been enabled.
[1970-01-01 00:00:03] The Telnet service had been enabled
[1970-01-01 00:00:03] WAN Mode is : DHCP.

This is the router:
http://www.ebay.com/itm/300M-3G-WAN-Wireless-N-WiFi-USB-AP-Router-2-Antennas-/200542526515?pt=AU_Networking&hash=item2eb1441c33

Is it normal?
maybe It  legitimate for configuration purposes? Like the citation bellow:

  ARP spoofing can also be used for legitimate purposes. For instance,
  network registration tools may redirect unregistered hosts to a signup
  page before allowing them full access to the network. This technique
  is used in hotels and other semi-public networks to allow traveling
  laptop users to access the Internet through a device known as a head
  end processor (HEP).[citation needed]

  ARP spoofing can also be used to implement redundancy of network
  services. A backup server may use ARP spoofing to take over for a
  defective server and transparently offer redundancy.

In case not, what should I do?

If you Google the log entry about arpspoofing you get a hit on the probable manufacture which is Huawei.  They hold a patent to prevent arpspoofing link to patent and their products are discussed in several articles as a solution to same.  TomTop appears to be a wholesale marketer of Chinese products including Huawei routers.

It appears you have a poorly written/translated standard log entry to a good feature.


Which companies facilitate payment in return for vulnerability disclosure? If requesting payment from an affected party directly for the disclosure of vulnerabilities  is considered extortion, how can independent security researchers earn a living or side income from researching security vulnerabilities?

In the 'white' sense, the most well known companies that pay researchers to buy vulnerabilities or exploits are:

Zero Day Initiative (ZDI) by TippingPoint: http://www.zerodayinitiative.com/
iDefense http://labs.idefense.com/vcp/
iSight https://gvp.isightpartners.com
SecuriTeam http://www.beyondsecurity.com/ssd.html
Netragard http://snosoft.blogspot.com/2010/03/recent-news-on-forbes-about-our-exploit.html
Several exploit research companies like COSEINC and Immunity also buy from researchers, although it's not advertised very much.

Certain companies like Mozilla and Google have established bug bounty programs - they buy vulnerabilities of their software themselves.

Charlie Miller (famous exploit developer) has written a small paper on the topic - it's an interesting read: The Legitimate Vulnerability Market: The Secretive World of 0-Day Exploit Sales (2007)


What standard alternative to ISO 27001 can be used for a small business? The business in question has high requirements for information security due to the sensitive nature of their work. The company has 5 people on staff and work with consultants from time to time. Is there another information security standard that can be used instead of ISO 27001 for a business of this size?

"OK, we can't achieve this standard, so let's look for a standard that we can achieve without much work"

is pretty much the opposite of a security-aware organization's mindset, though I'd agree (after 5 min of lecture) with the presumption that 27001 might be a bit much work – but then you'll have to just live without that certification.

Instead of trying to find an arbitrary certification that fits your organization, you might simply want to look into the standard and apply as much as possible to the 5-person-organization. A certification is worth nothing, to be honest, from a security perspective, but will cost you a lot of money. Actually adhering to sensible practices practically pays for itself.


How can I keep my identity anonymous as a website owner/administrator? My question looks touchy, but I'll do my best to explain. You see, I live in country where democratic rules are quite, well, delusive.

In theory, there is freedom of speech, democratic elections and so on, but in practice trying to do anything in opposition to the current government's political course leads to many problems.

For example, the police can say that you are suspected of breaking copyright laws and take away you computer for months, then return it, saying "Okay, we've checked it out, looks like everything is normal," But your time will be completely wasted.

That is a reason I want to create a political site, but I want it to be anonymous. I mean, anonymous in reference to who is supporting it in technical sense. It will be a public area though, where anyone across the country who has something important to say will have the ability to do so.

So my question is, what I should keep in mind to be as unreachable as possible? For example, remote deployment/development is not a problem; I can use ssh forwarding to encrypt all my traffic.

What I'm most concerned about is getting domain name and paying for hosting; is there anything else that I should be concerned about?

Buy gift cards in cash.

Bonus points for extra cloak & dagger shenanigans like buying cards in distant cities.
More bonus points for paying in advance to use up the card's value so you don't keep it.

Use a Live CD for all website activity. Don't mount any permanent storage devices.
Via anonymous proxy services (probably TOR) to establish a VPS or other hosting system.

Bonus points for buying it in a country that probably won't hand over info to your hostile country.

Register your domain via anonymous proxy.
Only access your system via the proxy.

That leaves no trace on your computer and no financial ties unless the card is found. If TOR traffic is suspicious to authorities, you might be able to use Amazon EC2 instances that are terminated after each session.


Is this a phishing attempt? if yes where to report? I received strange email from co-worker, asking me to click the link.

I did eventually follow the link, but thought putting in my gmail user/pass wasn't wise. What do you think? is this phishing attack? if yes where do I report it and get it taken down?

Link: www.collectablelegends.com.au/googledoc/Secure Login.html

Regarding my question, where to report it I found it here: Where to report malicious URLs, phishing, and malicious web sites?

It's a clear phishing attempt. Either your coworker's machine is compromised, or he subscribed to some innocent-looking malicious service that sends emails on his behalf.

Once you supply your password, it's submitted via non-secure HTTP to

www.collectablelegends.com.au/googledoc/gmail.php

and then you're redirected to

https://drive.google.com/?urp=http://www.collectablelegends.com.au/googledoc/Sec&pli=1

which is nothing special. If you were already logged in to your GMail account, that URL will show you your Google Drive, and a gullible user will think that he logged in using that phishing service.

As for where to report it, it looks like you already have the answer for that. Also, it would be nice if you report this to your coworker and/or the IT department in your company.


Port forwarding with VPN EDIT: My VPN has port forwarded a 5-digit tcp/udp port for me.
What kind of attacks am I opening the computer to with VPN port forwarding?

Any open port is susceptible to probes/attacks, it all depends on what service/application is running on it and how vulnerable is that service/application itself.

For VPN:

If using application, you need to find out how vulnerable is your VPN application.
What cipher suits are used.
Implement strong authentication measures.
Keep log of connections.


What are the security features of the proposed "secure email" from Brazil? Brazil has announced that they will create a secure email alternative in light of NSA spy programs. The company Correios will be implementing the contract over the next year or so.

What are the security features that will be included in this email platform?

No one knows at this very moment. (thanks @Terry)

It is highly possible that it is not even defined. There are several options, depending on what the Brazil government wants to do: do they want to stop spying, or do they want to stop spying from NSA ? (In the latter case, this means that Brazil could want to maintain possibility of spying by themselves).

The linked article contains the following excerpt:

  Data will be stored on local servers.

and also that one:

  For the user of the future service to actually be protected, however, the message recipient will also have to use Correios' email.

Both hint at some sort of network of decentralized encryption gateways. End users would connect to a specific gateway which would do all encryption and decryption, and ensure protection against spies on the big network links. However, the gateways would be in ideal place to spy on users. In a business context, we may imagine that each corporation would run its own gateway.

NSA spies would have to fall back to the methods that they.. already use... e.g. keyloggers or even simple bribery. Let it be a message: ye shall pay your sysadmins well, because they can see everything if they are such inclined.


Is my Android phone camera hacked? I suddenly see a strange thing when developing my Flutter application. My application that I'm developing is not asking for permissions, it does not need any permissions. But when I debug the app in my own physical Android phone device, I see that logs below which it looks like the camera is open and recording. I have closed my app and it's showing the logs again, and I checked if the camera is open in the recent apps, but it's closed. It's so strange. I did some research but I can't find anything.
I/CameraManagerGlobal(31346): Camera 2 facing CAMERA_FACING_FRONT state now CAMERA_STATE_OPEN for client com.samsung.android.smartface API Level 2
I/CameraManagerGlobal(31346): Camera 2 facing CAMERA_FACING_FRONT state now CAMERA_STATE_ACTIVE for client com.samsung.android.smartface API Level 2
I/CameraManagerGlobal(31346): Camera 2 facing CAMERA_FACING_FRONT state now CAMERA_STATE_IDLE for client com.samsung.android.smartface API Level 2
I/CameraManagerGlobal(31346): Camera 2 facing CAMERA_FACING_FRONT state now CAMERA_STATE_CLOSED for client com.samsung.android.smartface API Level 2

It's not hacked. It's just bloated by Samsung software.
What you see is a log of com.samsung.android.smartface leaking (if I can say that) into your application log.
This because logcat monitors logs globally and doesn't natively filter for your application only.
It is a Samsung application named "SmartFace".
What it does is to continuously activate front camera to scan for the user's face and detect eyes open in order to keep the screen always-on.
(source)

keep the screen on if you look at the phone: smart face

It is also a known bloatware
Conclusion
Another good reason to debloat devices


Should a 2FA recovery key be stored along with a password? Many websites give you a recovery key or a list of recovery codes that can be used in place of 2FA tokens if you lose your phone or can't access your token generator.

What are the recommended practices when it comes to storing these codes?

Should these recovery codes be stored along with the password in a password manager? Should they be physically written down and stored somewhere safe?

My main concern is the password manager being a single point of failure. If my password manager is compromised, 2FA is essentially worthless on all the accounts that have it enabled.

For your application, I would suggest, storing the recovery keys on plain paper that you put inside a home safe. Thats enough security. They rather steal the phone or 2FA token from you if they really want your account. And physical attacks are very rare.
Actually, you dont even need to put them in a safe. You can put them in the desk drawer at home.

But do not store them inside the password manager, since theres a too high risk a trojan will compromise the codes. Once you have unlocked the password manager with the master password, any trojan can compromise any password in your password manager.


How does ViewState protect against CSRF? According to the OWASP CSRF Cheat Sheet viewStateUserKey for ASP.NET ViewState is acceptable to prevent csrf attacks, but I really don't get how. I get that this makes it hard for an attacker to modify the viewstate since they would basically have to know the user's session id, but a form's post parameters are not stored in the session state so you don't need to modify that in your attack.

Is the whole concept around the fact that it is difficult to obtain a valid viewstate to begin with, or am I missing something?

Is this really considered a valid technique to prevent csrf?

If you enable the ViewStateUserKey, then the server will protect the integrity of the view state by appending a random, unguessable checksum.  This checksum acts much like a random CSRF token.

In particular, ViewStateUserKey will compute a Message Authentication Code (MAC) on the view state fields.  A MAC is like a keyed checksum of the data, where the key is known only to the server.  Because the attacker does not know the key, the attacker cannot generate a valid checksum (MAC digest) for some other value of view state parameters.

If you use a ViewStateUserKey, then the key used is specific to the particular user.  This means that a malicious attacker Mandy cannot learn a valid value of the MAC digest for user Bob.  Mandy cannot guess it, because a MAC algorithm is designed to prevent guessing the MAC digest.  Mandy cannot learn it by contacting to the server, because if she connects to the server, the server will use her cryptographic key, not Bob's key, so the MAC digest that is sent to Mandy will be unrelated to the one used for Bob.

In effect, the MAC digest acts like a random 128-bit string that the attacker cannot guess.  This is what prevents CSRF.  Standard CSRF defenses involve including a random string in the request parameters (random, so that the attacker cannot predict it).  With a ViewStateUserKey, the MAC digest acts as that random string.

See also Microsoft on Securing View State
and Does ASP.NET Viewstate implicitly prevent CSRF attacks? What does this mean for MVC?.


Is login limiting still needed if we employ multi-factor authentication? The status quo is that most online websites limit login attempts per IP address, or even per account since some attackers possess huge amounts of IP addresses.

Removing login limits would have the advantage that attackers would no longer be able to fraudulently deny access (availability) to legitimate users, be it by IP address or by account. OWASP declares:

  When multi-factor is implemented and active, account lockout may no longer be necessary.

How true is this statement? Does it mean that if our website employs mandatory multi-factor authentication (e.g. Google Authenticator), we can then safely remove our "IP address login limit" and "per account login limit" mechanism?

Is it still possible to brute force through multi-factor authentication if there are no login limits?

If login rate-limiting is implemented properly, then there are no downsides, and it should be used with or without 2FA (and in fact with the 2FA attempts themselves).  And account lockout is not the proper way to rate-limit login attempts.

Rate-limiting means you restrict the number of attempts a given source can make. Typically this means a given IP address, though you can define "source" however makes sense in your situation.

There are really three types of attacks you're trying to defend against here:
(a) The attacker knows the password -- in which case lockouts won't help even
a little.
(b) The password is easily guessed, like "123456" or "passw0rd", or "zxcvbn". Again, account lockouts won't be helpful because these attackers don't try more than 5 or 10 passwords at the most before moving to the next account. Often they'll try only one. You need to block the attacker, not the account.
(c) The attacker is making a determined go at a single high-value account and will try the whole dictionary and then some. The password may not be easy to guess, but the attacker has all month.

There's not much we can do about condition (a) above, though 2FA can help. Condition (b) is extremely common while (c) is a bit more rare because the success rate is so low. But importantly, both can be thwarted by slowing down the attacker.

Ideally this doesn't mean a hard limit of 15, and then you wait 10 minutes. Ideally you do an exponential back-off. This means after 2 attempts, you wait several seconds. After the third, you wait a bit longer. And then longer after the fourth, and so forth. The limit is enforced in the back-end, and in the front-end you use some client-side logic like a timer in javascript to keep the user from submitting attempts during the waiting period.

I've explained this technique here several times, so I won't go too deep into the details. But the important thing is that it is simple to build, doesn't noticeably inconvenience legitimate users, but it does work very well against determined attackers. By slowing them down, you're effectively setting a hard limit on how many attempts they can make in any given timespan, but doling out that limit incrementally between attempts. And better still, you can detect which users continue to send attempts during the waiting period, which flags them as using specialized software to circumvent your client-side rate-limiting. Cool!

If you set things up like this, then there's no reason to disable rate-limiting. It has no real drawbacks, is largely invisible to users, and offers a reasonable front-line of defense against brute-force attackers.

This only leaves the scenario of a distributed attack against a single login from a large botnet. This is rare enough to never actually happen for most sites, but it's simple enough to detect and address, so I'll leave that as an exercise to the reader.


Is XSS in canonical link possible? During regular pentesting of my site I discovered that I can close double quotes in a canonical link tag and enter an onerror attribute with a simple javascript alert(1).

It is visible in source code but javascript did not execute.

I also tried with onload event but same result.

Is there a way an attacker can use different payload to execute javascript ?

You can use the same trick as can be used with hidden inputs:

<link rel="canonical" accesskey="X" onclick="alert(1)" />

On Linux, use ALT+SHIFT+X to trigger the payload. IMHO it's enough to report the issue and get it fixed, but it does require some unlikely user interaction.

Other than that, I see no way to exploit this in a modern browser without further code.

While the link tag supports the onload attribute, it only fires when something is successfully loaded, eg:

<link rel="stylesheet" href="http://localhost/test.css" onload="alert(1)">

If your injection were <link href="[user input]" rel="canonical">, then you could exploit it via http://somedomain/somecsssfile.css" rel="stylesheet" onload="alert(1).

The WHATWG spec defines that the first attribute must be used, so it is unlikely that any browser would use the second, so this will not work for your case.

I tried all other event attributes, and none trigger on a normal page load.

This blog post states that this would be exploitable under IE7 and IE8 by injecting a style attribute which then uses an expression to execute JavaScript.

If there is additional JavaScript code that insecurely processes elements, this might also become exploitable (see here for an interesting example).


If I set up a home web server, will computers that use my wi-fi be vulnerable? I'm interested in setting up a web server on an old laptop L1.  My plan is to connect that laptop to an Ethernet port on my router.  I also have another laptop L2 accessing the router via wi-fi.  L2 is running Windows 7; I haven't chosen an OS yet for L1 but it will probably be a Linux distro.  If someone attacks my website and somehow gains control of L1, can they access L2 as well?  I'm trying to figure out how I can use L1 as a laboratory for security testing and web development without putting L2 at risk.

L2 is also vulnerable if everyone can access your home server using public IP (if you have one). As long as you set up a home server only using private IP (NAT), it will be accessible only to people who connected to your network, but including people who use your wi-fi since they are in a same router. If it's your only option, just make sure that your wi-fi is secure enough.

Another option to build a private home lab for security testing, you can use virtual machine, so you can test anything to your virtual machine without any risk.


Why hasn't it become the norm to inhibit repeated password guesses? Everyone is aware of the convention/need for strong passwords.  With the number of different kinds of clues people can use in their passwords, plus the various permutations of caps and digit-letter substitution, a hacker would need to make many attempts on average, in order to get the successful password.

This link:  Slowing down repeated password attacks
discusses some effort to discourage all that guessing, although it's not the same question I have:  Why hasn't it become the norm to interfere with repeated guesses?  An increasing backoff time after each wrong guess is one way, and others have been discussed.

I have seen very few attempts to inhibit such guessing on Linux systems, or any web-based authentication.  I have been locked out of one system when I got it wrong 3 times.

IT folks impose more and more constraints, like character count, letters, digits, caps, and exclusion of user name from password.  But that simply increases the number of needed attempts in a situation where the number is not really restricted.

I'd like to challenge your assumption that this isn't being done.

[warning: wild approximations to follow]

Remember that a successful brute-force attack will require millions or billions of guesses per second to do the crack in a reasonable amount of time (say, a couple hours to a month depending on the strength of your password). Even a rate-limit of 100 password attempts per second would increase the crack time from a month to hundreds of thousands of years. Maybe my standards are low, but that's good enough for me, and no human user legitimately trying to get into their account will ever notice it. Even better if the rate-limit was by IP rather than by username just to prevent some kinds of Denial-Of-Service attacks.

Also, I don't know which Linux distribution you're using, but on my Ubuntu and CentOS systems, when I mistype my password at either the GUI or terminal login screens, it locks for 1 second before re-prompting me.

Even if the server isn't actively rate-limiting login attempts (which they really should be), just the ping time by itself is enough to slow you down to millions of years. You'll probably DDOS the server before getting anywhere close to 1 billion guesses / second. The real money is in getting a copy of the hashed passwords database and feeding that into a GPU rig where billions of guesses per second are possible.

TL;DR: if you are going to put effort into hardening your login server, you'll get more bang for your buck by improving your password hashing, and making your database hard to steal than by implementing rate-limiting on your login screen.

UPDATE: Since this went viral, I'll pull in something from the comments:

This logic only applies to login servers. For physical devices like phones or laptops, a "3 attempts and it locks" or a "10 attempts and the device wipes" type thing still makes sense because someone could shoulder-surf while you're typing your password, or see the smudge pattern on your screen, or know that a 4-digit PIN only has 10,000 combinations anyway, so the number of guesses they need to do is very very much smaller.


DNSspoof not working My aim is to DNSspoof.

My network is using a wireless router with the address 192.168.1.1 and primary DNS is the same as the router address.

I have enabled Kernel IP forward in Linux.

DNS host file is
spoofhosts.txt

173.252.74.22  google.co.in

My victim machine is 192.168.1.224

I have done ARPspoof using

#sudo arpspoof -t 192.168.1.224 192.168.1.1 -i wlan0
#sudo arpspoof -t 192.168.1.1 192.168.1.224 -i wlan0

and I have done DNSspoof

ashok@c:~$ sudo dnsspoof -f spoofhosts.txt -i wlan0 host 192.168.1.224 and udp port 53
[sudo] password for ashok:
dnsspoof: listening on wlan0 [host 192.168.1.224 and udp port 53]
192.168.1.224.15703 > 192.168.1.1.53:  32219+ A? google.co.in
192.168.1.224.15703 > 192.168.1.1.53:  32219+ A? google.co.in
192.168.1.224.14489 > 192.168.1.1.53:  3788+ A? google.co.in
192.168.1.224.14489 > 192.168.1.1.53:  3788+ A? google.co.in

I am getting the above responses, but DNSspoofing is not working for the victim.

However, I have observed in Wireshark at the victim system. It gives me this information by that I have observed that the DNS response is coming from the router faster than me.

See the second line that is giving the response from directly from the router with valid Google IP.

How to solve this? Is this the problem with the DNSspoof command? What happend?

Finally, I got it!

Dnsspoof can't modify DNS packet, it can only send another prepared packet with spoofed address. But the real packet comes to victim as first and victim's computer take into consideration only it.

The solve our problem is blocking the real packet. I made this using iptables with specific address in hex:

# iptables --append FORWARD --match string --algo kmp --hex-string '|e1 e0 68 2d|' --jump DROP

You can find your website target ip in hex in Wireshark or another sniffer when you connect with server in correct way.

I know this isn't the best method but it works :)


Why would salt not have prevented LinkedIn passwords from getting cracked? In this interview posted on Krebs on Security, this question was asked and answered:

  BK: I’ve heard people say, you know this probably would not have
  happened if LinkedIn and others had salted the passwords — or added
  some randomness to each of the passwords, thus forcing attackers to
  expend more resources to crack the password hashes. Do you agree with
  that?

  Ptacek: That’s actually another misconception, the idea that the
  problem is that the passwords were unsalted. UNIX passwords, and
  they’ve been salted forever, since the 70s, and they have been cracked
  forever. The idea of a salt in your password is a 70s solution. Back
  in the 90s, when people broke into UNIX servers, they would steal the
  shadow password file and would crack that. Invariably when you lost
  the server, you lost the passwords on that server.

Ptacek doesn't really explain why this is the case--he only says that salt has not prevented this type of attack in the past.

My understanding is that salt can only prevent pre-computation of password hashes because of the space needed to store the precomputed hashes. But if you have compromised the system, you will have both the salt and the hash. So the time to dictionary attack the hash does not change significantly (just an extra concatenation of the salt to the dictionary word).

Is my understanding correct?

Krebs follows up on this question, and Ptacek does clarify what he meant:

BK: Okay. So if the weakness isn’t with the strength of the cryptographic algorithm, and not with the lack of salt added to the hashed passwords, what’s the answer?
Ptacek: In LinkedIn’s case, and with many other sites, the problem is they’re using the wrong kind of algorithm. They use a cryptographic hash, when they need to use a password hash.

In the next couple of paragraphs, he also elaborates on the reasons for it. The long and the short of it is that SHA1, with or without salt, is far too fast to be used as a password hash. It is so fast, that when computed using a GPU or something similar, you can brute force 10s of thousands of hashes per second. As is elaborated on later in the interview, LinkedIn should have been using bcrypt, which is an adaptive hash that would have slowed the brute force time down to the order of 10s of hashes per second.


How to prevent users from copying their outlook pst file to an external disk or system We allow 4 gb space per employee in outlook mail exchange, beyond that the user has to create a pst file . That is the policy.

We have given admin rights to all employees since there is a lot of travelling and site visits. Before an employee leaves the company, he always copies the pst files into an external drive. This is leakage of valuable information.

Is there a way to prevent the pst files from being copied into an external drive/laptop?
And if the need arises, only the IT admin should be able to do it.

I am looking for some sort of encryption or exchange policy for this. Any solution is welcome. Thanks a million

There is no reason to give your employee local admin rights on their computer, there is the principle of least privilege, please look it up and implement it. Giving everyone admin rights is a big no-no and can be even more dangerous when it comes to data leakage as successful attacks to your employee's their computer can now also result in exposure of your domain administrator account (due to cached credentials).

Furthermore data extraction is very hard to solve if the employee has rights to read the file in the first place. If you are allowed to read the file (which I imagine is important if you want to read email) then there is nothing you can do.

The only way to solve this is to set up a policy which explicitly disallows storing PST (or any other corporate data for  that matter) on non-company approved external media. When they leave the company they are required to return all media. If they don't do this after they leave the company and you can prove they actually took company secrets with them, you can sue them for corporate/industrial espionage.


Why not use sudo instead of setuid/setgid? If it is an insecure practise to use setuid/setgid binaries, why do distributions, OSes force it?

The big question: what prevents using sudo instead of the setuid/setgid binaries?

"ping" would be enough for root, no? If a user wants it, give it sudo permission?

Because your suggestion doesn't reduce the attack surface at all. In fact, it increases it. With programs like ping being setuid, it would take a vulnerability in ping itself to exploit it. If the file itself weren't setuid, and users instead had permission to use it via sudo, then either a vulnerability in ping or one in sudo would do. And even if the system has sudo anyway, most of the security bugs that have been found in it over the years have been ways for a user with some sort of permission to use sudo to instead gain full root. Bugs that a user with no sudo access at all can exploit are essentially unheard of.


Safely connect to remote site from cloud based code I am connecting my computer located at my home to a remote server.

To communicate with the server, I use a config file that contains my private and public keys and a passphrase. My code reads the config file and sends a message containing the signature from the private key, the public key and the passphrase.

Now, I would like to run my code on the Cloud, for example AWS.
I suppose it is not safe to store the config file on AWS, so what would be the correct way to connect safely from AWS to the remote server ?

The solution I use in the case of secrets (not only for your case, but also to make sure that I do not commit them with the code) is to put them in an environment variable when starting my code

$ API=kjsdhtgsdsdskdjsldjsldjklskjd /usr/bin/python3 mycode.py

It is not absolutely secure as the key is still in memory. It is also a pain to start the command with the secrets like this.

I usually end up adding the keys to the systemd service file I start my code with. It is in a file, but at least not together with the code.

Finally you can prompt for the keys at startup, which is not practical is the code is supposed to run headless.

The enterprise solution is a HSM, which is a glorified service to retrieve your keys from, based on some criteria.


What is dynamic SSL certificate? I'm confused with the term "Dynamic SSL certificate", how it works and what the difference is with a usual SSL certificate for web communication between client and the server.

For example, I'm using ZAP proxy. We must set the SSL certificates that are dynamically generated by the application and save it, so our browser can use that certificate for proxying the traffic.

Is it possible that SSL certificate doesn't have to be stored on the server and can be dynamically generated by the application? Does Zap also run its own CA (certificate authority? So every generated SSL certificate is clarified on its own?

I think all this means is that:

Zap requires an SSL cert to intercept your browser connections
To do this, they'll need to create a CA cert that users need to install on their browsers
Instead of creating one static CA cert used by all their users, they create a dynamic CA cert that users generate individually and install on their machines during setup.
This way, if someone compromises a users CA, that compromise doesn't impact other users using their solution -- as every user has a unique CA cert.

The 'dynamic' only refers to the CA cert, and it being unique per user.


I can't execute commands through proxychains I am trying to execute a ping throught proxychains, after create SSH tunnel, but the response of the petition is Destination Host Unreachable.

Concretly, I want to do a lab about pivoting. The attacker machine have visibility over A machine, but not over B machine. A machine have visibility over B machine. In this probe, I want to verify created tunnel execute a ping to B machine from attacker machine.

I have this on /etc/proxychains.conf :

socks4  127.0.0.1 9050

And I used these two commands:

ssh -D 9050 user@192.168.1.132

ssh -f -N -D 9050 user@192.168.1.132

But any of them allow me to execute a ping with proxychains.

What can I do?

Socks proxies TCP and UDP, while ping sends ICMP packets. So you need to test using another protocol. If you want it lightweight and stateless like ping you can try to resolve a DNS name for testing UDP. Otherwise try to load a website for testing TCP connectivity.


Can you recommend a good book on Backtrack/Metasploit? I have just downloaded Backtrack 5 R2 with Gnome and, while it looks cool, I don't really know where to start.

I see it comes with Metasploit but, to be blunt, I still don't really understand what Metasploit is.

A quick disclaimer, I'm a Windows guy with little experience with Linux.

I understand that I don't need Backtrack to use the tools that Backtrack comes with. Backtrack just makes this convenient. I can install any Linux distro and, after adding the relevant repositories, use apt-get install to install the tools. I also understand that I can get Metasploit for Windows, but get the feeling that it is probably a lot more useful on Linux.

I have a free weekend coming up, and am therefore asking if somebody could recommend a decent book that would bring me up to speed on Backtrack/Metasploit?

To be very honest, I feel that most of the books out there on Metasploit are outdated, as it gets updated very often.

To learn more about the two, I would first download Metasploitable. This is an old configuration of Ubuntu with security holes for learning purposes.

The Metasploit and Backtrack FAQs are good places to start. Learn what each tool does, Backtrack consist of hundreds of tools, most of them you will probably never use. Take a look at your situation, and find the appropriate tool to use. Google is your good friend here.

Metasploit is simply an exploitation framework. The beauty of it is the ability to combine different exploits with different payloads to adapt to different situations. Metepreter is also an incredibly powerful shell to perform privilege escalation and other attacks from once you gained access.

Once you cracked Metasploitable, there are many other vulnerable VMs to exploit, here is a link to a question i had asked which has suggestions for many good practice boxes.

The key to understanding Backtrack and Metasploit is simply using it and getting familiar with the commands. Basic understanding of linux is of course needed, as many of the task in Backtrack are performed using the command line interface.

If you really want a book - this is highly recommended by others, although i have never actually read it.

I do not however, recommend installing the repositories on another OS unless it is really necessary. Why not use something that just works? Backtrack's theme is very cool to boot.


Is including the data scheme in your Content Security Policy safe? I have a Cordova app that transforms some images to base64. This violates CSP with this message:

  Refused to load the image
  'data:image/svg+xml;charset=US-ASCII,%3C%3Fxml%20version%3D%221.0%22%20encod…E%3C%2Fg%...%3C%2Fsvg%3E'
  because it violates the following Content Security Policy directive:
  "default-src 'self'". Note that 'img-src' was not explicitly set, so
  'default-src' is used as a fallback.

According to this answer, I can simply add data: to my Content-Security-Policy meta, but I would very much like to know, if this is safe? data: does not specify origin and therefore I fear it's unsafe.

The note on whitelisting the data protocol which is referenced says

  data: Allows data: URIs to be used as a content source. This is insecure; an attacker can also inject arbitrary data: URIs. Use this sparingly and definitely not for scripts.

This is not in a part specific to the risks of data uris in images, and I have not seen any substantiative evidence that data uris in images can execute code in a modern browser any respect, nevermind XSS a page.

In certain contexts, an SVG image can execute Javascript code, but these are either child contexts such as <iframe>, <object> or <embed> elements, or a direct part of the host DOM i.e. <svg> elements.

MDN calls out explicitly that <img> embedded SVGs cannot execute Javascript, along with some other security restrictions, saying

  JavaScript is disabled.
  External resources (e.g. images, stylesheets) cannot be loaded, though they can be used if inlined through data: URIs.
  :visited-link styles aren't rendered.
  Platform-native widget styling (based on OS theme) is disabled.

It doesn't appear to be possible to specify a MIME as part of the data: protocol whitelisting statement as suggested as a possible mitigation. The only content security policy directive I've seen able to restrict MIME type is plugin-types, which restricts only for <object> and <embed> (see general CSP docs).

I will agree with the accepted answer in the respect that if you don't have to use data-uris, and can do so with little pain, it's easier to just keep your CSP and not use them. However, if you're working with images at all, that is usually a huge pain.


Suspicious wifi networks from distant places and hotels When I check my Macbook's network settings, I see some unfamiliar wifi networks from distant places like famous hotels. It's impossible to connect to those networks because I've never been to those places before.

Is it evidence that shows that I'm hacked?

No, it's just an evidence there are other Wifi network around you. These other Wifi networks most probably belong to other people or companies. You would be able to connect to them only if they give you the associated password, without that you can only see that they are here without being able to actually connect to them.


How can you steal cookies from Chrome? I'm new with security and have a few questions about it. I've searched and found that for example Google Chrome stores cookies in ~/.config/google-chrome/Default/Cookies. Just as an experiment I "stole" this file (from my VM) and put it in my directory. But I could not access anything, not Google Chrome account nor anything.

This is just for educational purposes. How do hackers steal a Google account or any other cookie by actually copying the victims cookie?

This is how it's done.
Go to some site, let's say facebook/netflix .
Check out the cookies that the site uses to authenticate you, you can edit the cookies from the dev tools! just mess around with them, edit them until you refresh the page and you are logged out, try to figure out what are the cookies that hold your session ID.
In facebook's case the cookies that are required are called "c_user" and "xs"

if you open a diferent browser (say firefox) or a diferent computer and paste those cookies while you are on facebook's domain using the dev tools, then you will be able to resume your previous session, that's session hijacking
You can add cookies on firefox on the development tools, under storage, by pressing that Plus button.

Facebook might complain, because it will see that you suddenly changed the user agent (or some other way of fingerprinting who you are) and will likely send you a notification asking about "suspicious activity" on your account.
The "cookies" file  you mention is a SQLite database that contains ALL these cookes, you can open it with sqlite browser and check them out yourself. The actual values of the cookies have been encripted in recent versions of chrome, so they cant be viewed from the sqli database so easily.
A few ways of getting the content of cookies from someone else are:

If the cookie is sent over HTTP instead of HTTPS and you are in a shared wireless network, you can sniff the traffic and get the cookie

If the cookie is not marked as HttpOnly then it can be read by javascript, if you can add some javascript to the site (this is called Cross site scripting) then you can read the cookies content and ask javscript to send that to some server you control.

After you have the cookie, you just insert it into the browser as shown above and you are done.
Usually important cookies are marked with the parameters

secure - It can only be sent over HTTPS
HttpOnly - It can only be used on requests, javascript has no access to it

So they are much harder to steal.
For more information on cookies you may want to read Their specifications
Edit: just realized that this question is so old. for some reason it appeared on the site's front page.


Consequences of grey hat hacking While I was working on a anomaly detection system (finding cheaters in a quite popular online game service) I accidentally found a way to get a password of a user in a reasonable amount of time. Basically, the whole idea to build an anomaly detection system was to apply for a job for that webservice and to provide my preliminary solution.

After finding this vulnerability I am thinking to apply there not only with a CV, but also with the detection system and explaining vulnerability as well. But here is a thing: I remember reading about a guy who found a problem in Yahoo! reported it and got rewarded, tried this with Facebook and got jailed.

Because I think that jail is not the best place for me, I would like to ask what are the chances of being charged with a crime?

To keep in mind

I am not working for that company
my main objective is to finish my cheat prediction classifier
the only passwords I tried to break were the passwords of my own dummy accounts
I want to work for that company

P.S: I think that I did not make myself clear. I am working on a classifier to give a prediction, whether the person is cheating in the game or not and because this is a big problem for that service - I am planning to apply for a job, having this classifier as an additional plus for my CV. I accidentally found a vulnerability and thinking whether I should report it or no,  and if yes, what problems can I face. It is going to be something like this, "here is the problem and here is what I think you should have done. If you want, I would like to work for you, but not as a security specialist (I do not have knowledge for this), but as a data-miner". Whether they will take me or not, I basically do not care.

It has nothing to do with the scenario: "I want to work for you and I know how to get a password of a user, so think twice before rejecting me."

There really isn't enough information here to make a determination about your question.  Jurisdiction and exactly what went on with how you found a flaw in the security and how you tested it and what their terms of service (which define how you are allowed to use their computers and data) all matter.  In general, "hacking" isn't what is legal or illegal, what is illegal is using other people's hardware or IP in a way which you are not licensed to do so.

If you were running an exploit against their hardware, then that was an intrusion, regardless of intent and they could go after you for it if they really wanted to.  If you took data that they licensed only for a particular purpose and abused the data in a way you were not entitled, it may also be possible for them to go after you based on jurisdiction.  If they provided data in the clear, without a license associated and you found a way to use that data to abuse their system on your own hardware, then you are probably safe since you did not use their hardware or licensed data to make your determination.  But again, this can vary widely based on jurisdiction, so knowing your local laws is the best policy and IANAL.

As for practical advice about how to approach it.  I would suggest that you not approach it as a proven vulnerability.  Certainly providing your anti-cheat system sounds like a plus.  You could also simply mention that you thought you saw something that might be exploitable when you were working on it and ask for their permission to either test it or let them test it.  You might be best off to not mention the vulnerability at all though until after you get a job with them or get declined on the strength of your anti-cheat system alone.  It is really hard to predict how people will react when a flaw is exposed by an outside party, even when reported responsibly.  Many of the possible reactions wouldn't work in your favor, whether denial, anger or suspicion.


Change LUKS encryption key (not passphrase) without dataloss You can change the LUKS passphrase without dataloss, but can you also change the actual key?

I reckon you would have to re-encrypt the whole disk, but that would be acceptable to me.

Background

We are considering distributing a live USB with full disk encryption. But that means that even if you change the passphrase, I will still be able to get the secret key if I got a copy of the original live USB.

So the first time you use it, it should re-encrypt the whole disk with a new key (and not just a new passphrase to unlock the key).

With the cryptsetup-reencrypt tool, you can change almost all aspects of a luks encrypted device like, the volume key, cipher, or even encrypt a device that is not encrypted. In some distributions, you will have to download the cryptsetup sources and recompile with the --enable-cryptsetup-reencrypt option. If you are using a Red Hat based distribution, you will be interested in this proof-of-concept dracut module at cyptsetup sources.

Running cryptsetup-reencrypt without parameters should be enough to start a new key being generated. But be aware that any power failure or error during the process could let data unacessible forever.


What trust level should I give keys I need for encryption? As I'm encrypting server backups, I typically install my public GPG key from a keyserver into me server's keyring:

gpg --search-keys 6569758F

I import the key into my keyring.

I then attempt to encrypt a file:

gpg --encrypt --recipient 6569758F myfile.log

I'm now presented with something like this:

gpg: EE928AAF: There is no assurance this key belongs to the named user

pub  4096R/EE928AAF 2013-12-05 Naftuli Tzvi Kay <rfkrocktk@gmail.com>
 Primary key fingerprint: 0E26 BDF1 BD1C 4A16 9571  21A8 8938 1D75 6569 758F
      Subkey fingerprint: 65F4 87F2 C898 F0E7 0377  EBA1 8484 EC48 EE92 8AAF

It is NOT certain that the key belongs to the person named
in the user ID.  If you *really* know what you are doing,
you may answer the next question with yes.

Use this key anyway? (y/N)

I now need to 'trust' the key. However, I've found that unless I trust the key "ultimately," ie: level 5, I get this prompt every time I need to encrypt something, which doesn't work too well for shell scripts.

Do I really need to trust a key ultimately to simply encrypt files with it?

The title of the post and the actual question you're asking don't quite match. If I'm reading this right you're asking how best to use your own public PGP key to encrypt backups. On the other hand the title of the question is getting at assigning trust levels to keys for encryption. Sounds to me like you're using your own key for the encryption so assigning it a level of trust isn't what you're looking for. IMHO you're using the wrong GPG 'trust model' for the the backup problem.

You can explicitly bypass all key validation in GPG by changing the 'trust model' for the command you're executing. By default the 'PGP' trust model is used which is why GPG expects you to explicitly mark keys as trusted. Alternatively you can tell GPG to use the 'always' trust model which will bypass the message you're seeing:

--trust-model always

I think this will get you the behavior you're after. Keep in mind though, your script is downloading a key from a remote host that you don't control so you don't really have any guarantee that it's the key you're expecting (key server compromise). If you're only expecting to use the one key to encrypt your backups it may be sufficient to simply embed the public key in your script (it's not sensitive) and cut the keyserver out of the architecture completely. This will remove all reliance on the keyserver and simplify the trust relationships in your backup solution.

Just a though. Hope this helps.

As requested here's an example. Let's assume I want to collect backup data on a system that I admin. I only want this backup data to be recoverable by myself. To achieve this I want all data collected in the script to be encrypted with my public PGP key. I'm also assuming that the user account doing the backup isn't used for anything beyond backups so there's nothing important in the ~/.gnupg directory and that I can delete it without worrying about lost keys.

ALWAYS BACKUP your .gnupg directory before playing around with this!

The following is a simple bash script that will encrypt some text with a public key that's embedded in the script:

#!/bin/bash -e

gpg --trust-model always --import <<EOF
-----BEGIN PGP PUBLIC KEY BLOCK-----
Version: GnuPG v1.4.12 (GNU/Linux)

xxxxxx
...
...
-----END PGP PUBLIC KEY BLOCK-----
EOF

echo "backup data" | gpg --trust-model always --armor  --encrypt --recipient guest@example.org > backup-data.enc

The 'magic' in this script is the use of the shell 'Here Document' (see the EOF markers) to embed my public key in the script while passing it to gpg over stdin to import my key before doing the encryption / backup task. Naturally you'll have to put all of your ASCII armored public key in place of the '...'s in my example. Also be sure to replace 'guest@example.org' with the ID associated with your public key. Typically this is your email.

There's a million ways to clean this example up and make it more useful. Importing the public key on each run is a bit ridiculous so checking to see if the key is already in the ring is where I'd start :)

Good luck!


Can JavaScript from different origins communicate securely I want to know if there is a way for JS from one Origin to delegate a task to JS from another origin in a secure way.

The use case is to have a JS Agent from the users' home origin use the JavaScript Web Crypto API, to save the key in the browser storage in a safe manner.

Other Apps should then be able to make request to that JS agent to sign specific things for identification purposes with that key. This would allow authorizing services to distinguish between the App authenticating for the user, and the user authenticating a request made by that App. More details.

Is there a standard way to do this correctly now?

I can see two options here.
The first is to just delegate the crypto part to a server, and communicate with it via a HTTP API. This wouldn't involve the JS web crypto API, and perhaps it would violate some of your design criteria.
Second option for communicating across origins is Window.postMessage(). It let's you send messages and receive responses between different window objects in different origins. It is largely up to you to enforce security here:

If you do expect to receive messages from other sites, always verify the sender's identity using the origin and possibly source properties. Any window (including, for example, http://evil.example.com) can send a message to any other window, and you have no guarantees that an unknown sender will not send malicious messages. Having verified identity, however, you still should always verify the syntax of the received message. Otherwise, a security hole in the site you trusted to send only trusted messages could then open a cross-site scripting hole in your site.
Always specify an exact target origin, not *, when you use postMessage to send data to other windows. A malicious site can change the location of the window without your knowledge, and therefore it can intercept the data sent using postMessage.

Note that an XSS vulnerability in any page you accept messages from will let an attacker post messages to your origin.


Is there value in slowing down retries on a fingerprint lock? My phone has a fingerprint lock and it sometimes fails to identify my fingerprint (for example, if it wasn't positioned correctly).

If I fail fingerprint identification 5 times in a row, I'm locked out for 30 seconds. This is very annoying for the user (me).

What's the security benefit here? Is there a way to brute-force fingerprints?

Any delay would be a security benefit. One way to look at it is that everything can be cracked, it is just a matter of time. By adding delays, one is increasing the amount of time it takes to break the security. You want the time it takes to crack to be longer than the time the item needs to be secure.

In the case of fingerprints, the fingerprint gets turned into a number. Numbers can be brute-forced.


Application bypassing proxy setting I am testing an Android application and found that it is bypassing/disregarding the proxy set (Burp proxy with root certificate installed and Certificate pinning disabled).

I can intercept https traffic from other applications but this application seems to not use the proxy.

Could anyone provide advice on how to intercept traffic for such applications?

If you have a rooted device you can force the app to go through the proxy with some iptables rules.

You may need to override any pinned certificates within the apk.


Is Duo MFA vulnerable to a SIM swap exploit? I'm looking into MFA options for a group of around 1000 people. Duo is intriguing, but I'm not sure I'm comfortable implementing something that incorporates text messaging (in contrast to something like WiKID which has only a passcoded app + OTP).

Does anyone know how Duo has designed their platform to mitigate SIM swap attacks? The auth mechanism baked into the application itself could certainly be hardened for it, but there seems to be a fair amount of "fallback" SMS stuff that goes on with it.

With Duo one can disable the SMS fallback option in the admin panel (this is according to documentation I haven't tested this to confirm they actually disable it).  If push is an option I recommend it (just make sure you train users about getting double push notifications and how this can be a sign of nefarious activity).  Documentation below.

https://duo.com/docs/administration-settings#restricting-authentication-methods


Antivirus vs Firewall with Antivirus I would like to know from an information security respect, is antivirus software needed to be separate from the firewall?

In my company, they have a Palo Alto firewall and they mention that it is a firewall and antivirus. Is that is acceptable in information security, or must they be separate?  Is that good solution or does it need to be changed?

It all depends on where you want the detection to be. Antivirus on the perimeter firewall detects viruses traveling across your perimeter. Antivirus on the computer detects malware on the computer. You need both. If you only have one, you lack the detection capabilities of the other.

For instance, if only on the perimeter, a virus can be built on a computer or passed computer to computer. If only on the computers, then rogue devices can send viruses out or viruses can come in and threaten devices that do not have antivirus (or are not updated).

One reason why you might not want antivirus on the firewall is if this extra feature increases the load on the firewall. But that is not a security concern, but an operational one.


Can TLS be used in P2P Encryption? I am designing a Point2Point encryption system.
I've  checked the WhatsApp's protocal. But our devices are Raspberry Pi so WhatsApp's protocal is too heavy.
We 'd like to use a PSK (pre shared key) method.
I've checked TLS which provides many ciphersuites and also PSK one.

But  in programming, I need to configure every device as server and client at same time*(Cause I dont know which device will invoke the communication). Is it a possible way?

Or I need to do it in a lower level way?Like first, Exchange public key ,then generating shared secrect then generateing shared key and so on.......

TLS is just a protected channel between two communication peers, usually on top of TCP. It does not matter if such a peer can be either client and server or even both at the same time (but not with the same peer). And it also does not matter for the roles in the TLS handshake in which direction the TCP connection was established.

For example in FTPS the TCP connection for the data transfer can be created from client to FTP server (passive mode) or FTP server to client (active mode) whereas the TCP handshake on top of the TCP connection is always initiated by the client so that the server certificate can be used for authentication in order to protect against man in the middle, i.e. sometimes in the same direction of the TCP connection (passive) and sometimes not (active mode).

Another example is SIPS (VoIP) where a SIP device is both client (for initiating calls) and server (for receiving calls). In case of SIPS the direction of TCP connection and TLS handshake match. Authentication is usually done for both client and server (i.e. mutual) where each provides the certificate matching the device. And, if the roles switch the same certificates will be used: if A calls B then B's certificate is used as server certificate and A's as client certificate, if B calls A then A's certificate is used as server certificate and B's as client certificate. And, in case of a SIP proxy the same system can be even be both SIPS client to some servers and SIPS server to some clients at the same time.

Thus, it is no problem to use P2P architectures like SIPS together with TLS. And one can also use certificates in such a setup as long as each node has a clear address or other identifier which can be used as subject of the certificate and then checked during the certificate validation. This way a PKI can be used for a more scalable trust model compared to PSK or SRP.


standards for regulation of intermediate Certificate authority I want to know some information about the regulation of intermediate CAs. Is there any standard for intermediate CA to determine how many intermediate CAs are required or something like that which concerns the application of intermediate CA?

CABForum "Baseline Requirements"
TLS certificates on The Web are governed primarily by the CA-Browser Forum Baseline Requirements, which all publicly-trusted CAs are required (by browser vendors) to follow.
In the Baseline Requirements (BRs), intermediate certificates are not explicitly required to be used at all. In theory, a CA could just sign all their certificates with their root certificate's key. From a practical perspective though, intermediates are necessary because the root key is usually kept offline to protect it from compromise by malicious actors.
If an intermediate certificate is issued to a third party, that party becomes a Subordinate CA of the original, Root CA. In such cases, the BRs specify that the Subordinate CA must follow the Baseline Requirements just as the Root CA does:
Section 1.1 says:

These Requirements are applicable to all Certification Authorities within a chain of trust. They are to be flowed down from the Root Certification Authority through successive Subordinate Certification Authorities.

Currently, the Baseline Requirements grant the Root CA the responsibility of ensuring that its Subordinate CAs follow the Baseline Requirements.
Section 9.6.1 says:

The Root CA SHALL be responsible for the performance and warranties of the Subordinate CA, for the Subordinate CA’s compliance with these Requirements, and for all liabilities and indemnification obligations of the Subordinate
CA under these Requirements, as if the Root CA were the Subordinate CA issuing the Certificates

Mozilla Root Store Policy
Additionally, some browsers' root store programs may impose additional regulations on intermediate certificates above and beyond what the Baseline Requirements require. Mozilla for example, requires the existance of any subordinate CA certificates to be disclosed publicly in section 5.3.2 of their Root Store Requirements:

All certificates that are capable of being used to issue new certificates, that are not technically constrained, and that directly or transitively chain to a certificate included in Mozilla’s root program MUST be audited in accordance with Mozilla’s Root Store Policy and MUST be publicly disclosed in the CCADB by the CA that has their certificate included in Mozilla’s root program. The CA with a certificate included in Mozilla’s root program MUST disclose this information within a week of certificate creation, and before any such subordinate CA is allowed to issue certificates. All disclosure MUST be made freely available and without additional requirements, including, but not limited to, registration, legal agreements, or restrictions on redistribution of the certificates in whole or in part.

Aside from that, I'm not aware of any further standards regulating the use of intermediate certificates.


Does the DICOM file header gets lost when transferred over the network? I am currently investigating the PEDICOM vulnerability CVE-2019-11687 where I am trying to reassemble the P-DATA DICOM fragments from a PCAP. Since the vulnerability takes advantage of writing bytes onto the header, I want to investigate this. When sniffing the network and trying to capture and reassemble the file, when sent over the network using the DICOM protocol does it lose its header and the only information is sent are the different data elements?

When a file is being sent over the network using the DICOM protocol, the file header is lost. This is because the only fragments or parts of the file that is sent are the P-DATA-TF packet data unit which contains patient information as well as the image pixels.

The only way to keep the file header when sent over the network is by using a transfer protocol such as SMB or TFTP.


How do programmers write the initial exploits from the vulnerability details in a CVE? I've noticed that lots of CVE at www.cvedetails.com do not have publicly available exploits. But they have high scores (ex: score higher than 9).
With such a high score, I'd thought exploits would be readily available but it's not the case (not even present in exploitdb).

So how would a hacker, from the description at www.cvedetails.com write exploit code? Do hackers do that?

You wanted a broad answer:

Read about the bug
Attempt to understand the bug
Use a fuzzer to find the crash
Attempt to exploit crash
Profit.

Fuzzing is only one method. Please seek additional resources to learn about more methods.