Creating an X.509 certificate with an invalid signature Creating an X.509 certificate with a valid signature with OpenSSL is pretty well documented all over the Internet. There are instructions on creating certificates that are signed by themselves and certificates that are signed by a certificate authority (CA). But how does one create a certificate with an invalid signature?

The simplest way to create an X.509 certificate with an invalid signature is to create one with a valid signature, and then alter the signature. A simple text editor will do the trick if you use the PEM encoding of certificates (the one with the "-----BEGIN CERTIFICATE-----" header and Base64 encoding).

X.509 certificates use ASN.1 and the signature value comes last, as specified in the standard:

 Certificate  ::=  SEQUENCE  {
     tbsCertificate       TBSCertificate,
     signatureAlgorithm   AlgorithmIdentifier,
     signature            BIT STRING  }

So for instance, take this certificate with a valid signature:

-----BEGIN CERTIFICATE-----
MIIGgTCCBWmgAwIBAgIIP2loSeAn4ucwDQYJKoZIhvcNAQEFBQAwSTELMAkGA1UE
BhMCVVMxEzARBgNVBAoTCkdvb2dsZSBJbmMxJTAjBgNVBAMTHEdvb2dsZSBJbnRl
cm5ldCBBdXRob3JpdHkgRzIwHhcNMTQwNTIyMTEyODU3WhcNMTQwODIwMDAwMDAw
WjBmMQswCQYDVQQGEwJVUzETMBEGA1UECAwKQ2FsaWZvcm5pYTEWMBQGA1UEBwwN
TW91bnRhaW4gVmlldzETMBEGA1UECgwKR29vZ2xlIEluYzEVMBMGA1UEAwwMKi5n
b29nbGUuY29tMFkwEwYHKoZIzj0CAQYIKoZIzj0DAQcDQgAEQ80mW9KOdkTavOvJ
T8KdnZW/ClBvM2DNSYlXEjlHxLfN23DIgwfk7xnThlwyH4RTk4bhhtWtBTyR9Gh4
3BIE5aOCBBkwggQVMB0GA1UdJQQWMBQGCCsGAQUFBwMBBggrBgEFBQcDAjCCAuIG
A1UdEQSCAtkwggLVggwqLmdvb2dsZS5jb22CDSouYW5kcm9pZC5jb22CFiouYXBw
ZW5naW5lLmdvb2dsZS5jb22CEiouY2xvdWQuZ29vZ2xlLmNvbYIWKi5nb29nbGUt
YW5hbHl0aWNzLmNvbYILKi5nb29nbGUuY2GCCyouZ29vZ2xlLmNsgg4qLmdvb2ds
ZS5jby5pboIOKi5nb29nbGUuY28uanCCDiouZ29vZ2xlLmNvLnVrgg8qLmdvb2ds
ZS5jb20uYXKCDyouZ29vZ2xlLmNvbS5hdYIPKi5nb29nbGUuY29tLmJygg8qLmdv
b2dsZS5jb20uY2+CDyouZ29vZ2xlLmNvbS5teIIPKi5nb29nbGUuY29tLnRygg8q
Lmdvb2dsZS5jb20udm6CCyouZ29vZ2xlLmRlggsqLmdvb2dsZS5lc4ILKi5nb29n
bGUuZnKCCyouZ29vZ2xlLmh1ggsqLmdvb2dsZS5pdIILKi5nb29nbGUubmyCCyou
Z29vZ2xlLnBsggsqLmdvb2dsZS5wdIIPKi5nb29nbGVhcGlzLmNughQqLmdvb2ds
ZWNvbW1lcmNlLmNvbYIRKi5nb29nbGV2aWRlby5jb22CDSouZ3N0YXRpYy5jb22C
CiouZ3Z0MS5jb22CDCoudXJjaGluLmNvbYIQKi51cmwuZ29vZ2xlLmNvbYIWKi55
b3V0dWJlLW5vY29va2llLmNvbYINKi55b3V0dWJlLmNvbYIWKi55b3V0dWJlZWR1
Y2F0aW9uLmNvbYILKi55dGltZy5jb22CC2FuZHJvaWQuY29tggRnLmNvggZnb28u
Z2yCFGdvb2dsZS1hbmFseXRpY3MuY29tggpnb29nbGUuY29tghJnb29nbGVjb21t
ZXJjZS5jb22CCnVyY2hpbi5jb22CCHlvdXR1LmJlggt5b3V0dWJlLmNvbYIUeW91
dHViZWVkdWNhdGlvbi5jb20wCwYDVR0PBAQDAgeAMGgGCCsGAQUFBwEBBFwwWjAr
BggrBgEFBQcwAoYfaHR0cDovL3BraS5nb29nbGUuY29tL0dJQUcyLmNydDArBggr
BgEFBQcwAYYfaHR0cDovL2NsaWVudHMxLmdvb2dsZS5jb20vb2NzcDAdBgNVHQ4E
FgQUZ+wFAJG6n8knT4i1EhyqBhTlMxgwDAYDVR0TAQH/BAIwADAfBgNVHSMEGDAW
gBRK3QYWG7z2aLV29YG2u2IaulqBLzAXBgNVHSAEEDAOMAwGCisGAQQB1nkCBQEw
MAYDVR0fBCkwJzAloCOgIYYfaHR0cDovL3BraS5nb29nbGUuY29tL0dJQUcyLmNy
bDANBgkqhkiG9w0BAQUFAAOCAQEAFId/P3amOfPZtGwUDvIZlfp4kUJ/Qr/y9KMc
syO7YdcO+mSwOarZtZ1UdB3zBJ3d7vn2Ld1G0TiqFW8vIZk1OtWtdMC6hFQuC21P
Papck9jRhLZO1Jx4uFbGQdWM25z+a1TzxaoULmhAN9FF38OFKcrZlb/Gf4uETYV7
mMFQ10GT6UBESCkvEsT4hgEONQ/wXiOxDgMrbXBBm67IfXJzxmpncPDG6o49Dqw4
F6Jkkotp7ca6OvBnTvi0hcd4qS/64c/+0SjjLsWFq04W/zRJAUvF7mt8yiZHmv8f
E+FdDynG49hiV4MhWpmLdY5xzOWqb7+xmPdo3947SoHe9ZO2Mg==
-----END CERTIFICATE-----

(This is one of Google's certificates, I hope they don't mind.)

To turn that certificate into one with an invalid signature, you just have to modify one letter at the end. Don't touch the '=' signs (if they are present -- they are padding for Base64 when the binary data length is not a multiple of 3); to avoid an exceedingly rare potential issue with BER encoding, don't modify one of the four letters which immediately precede these equal signs (or end of data) either. To do what you are trying to achieve, you may change the last 'Z' into another letter (e.g., a 'Y'), so that the last data line now reads:

E+FdDynG49hiV4MhWpmLdY5xzOWqb7+xmPdo3947SoHe9YO2Mg==

and voilà! a certificate which decodes properly but has an invalid signature.


Why does the issuance speed of a CA depend on the number of certs they have already issued? I have seen proprietary testing results of pummelling a CA for a long time and measuring its throughput (certs issued / second). It was found that CAs become slower to issue new certificates as the size of their database / revocation list grows (proprietary work, no results to link to sadly). For example, some corporate infrastructure CAs (ex.: S/MIME) bog down with around 100,000 certs in the database. EJBCA bogs down around 1 million certs, etc.

My question is: databases can easily handle fast lookups / inserts on millions of lines, so what is different about certificate issuance? Presumably there is some sort of crypto going on whose runtime depends on the size of the database.

Note that this is a follow-on question from comments to this question.

Self-answer.

The comments suggest that these results can be explained by the fact that we are doing near-constant inserts into an unmanaged, one-size-fits-all database, and that they could likely be fixed by putting some effort into the database.

In mentioning this to a colleague, it was pointed out that some CAs will - as a courtesy - check that your public key is unique to prevent one server from impersonating another. That would require an O(log n) search, or background hashtable maintenance, or something else that would use non-trivial amounts of CPU as the database gets large.


Save encrypted data in server . With no way for server to read actual data Hello i am developing an app that collects some private data from my clients. My clients wont like it if i am able to read the data. So the data is encrypted in cleint side with a key say "xyz",which is auto generated when client install the app/make a account and only with this key can someone read this data.
Now when the client login from a new device i want the client to generate the key, and use it to retrieve the data . How do i do that?
I cant save xyz in server since then i will have both key and encrypted data, I cant generate xyz with password or User details since i will have them and i knows how to create the key from that data
Is there a way to achieve this without saying to client Trust me am truest worthy. Or make your own key!?

The usual way is to use a two-level key.
You encrypt the data with key_data, which should probably be a symmetric key.
You keep a separate key-file where key_data is encrypted with the key from the devices (key_dev1, key_dev2, ...)
You do not know the key_data; it must be generated by the first access. You also do not know the key_dev1,... because they are on the device of the client.
The client can decrypt the key_data with an existing device, and pass it to a new device which encrypts it with its new device key before uploading it to your key-file.
Of course, something needs to be done with key management by your client; you may want to facilitate this. Be careful that you never get the decrypted key_data on your devices though.


Send a CSRF attack with a specific header referrer? There's any way to bypass a referrer CSRF protection and force www.attacker.com to send a POST request to www.victim.com with the header showing as "referer: https://www.victim.com/"?

For example the script below can change the referrer from the browser page but can an attacker send a request showing a different referrer domain to www.victim.com.

    <script>
          delete window.document.referrer;
            window.document.__defineGetter__('referrer', function () {
                return "https://www.victim.com";
            });
alert(document.referrer)
    </script>

https://jsfiddle.net/x3a7k1m0/

I know there are ways to bypass some referrer CSRF protections For example showing the referrer requests with empty or blank  but what if the web application rejects empty or blank referrers and a "specific domain or subdomain" is need it in order to process the POST request.

It would be possible to bypass this protection from an external domain?

Referer is considered a special header (like `Host´) and can not be set inside the browser. So the most you can do with some tricks is to make it empty, but not to point to some other site.

Of course you could use some other tools to make crafted requests with your own Referer header. But in this case you (as attacker) don't have access to the cookies relevant for the target site so it would not work as an CSRF attack either.


Found 0000 Permission Files on a hacked server Its been a long week trying, at times when I can, to figure out what is happening on a server/website I am maintaining. The site was previously hacked, supposedly cleaned up by previous owners, and upon transfer to us, within hours, its hacked again.

Anyways, the question: if there are 0000 permission files on the server, can I assume the the hacker has root access?

(I don't even have root access...)

For clarity from a comment below: "But what I meant was, why would an intruder make a file 0000? I would imagine that they would want access to the file at some point. So if they made this file, I would imagine that it would be safe to guess that they have root access?"

[UPDATE] In case it wasn't clear, this site went live from another server roughly mid-May. I went back and checked the logs, and a few hours after the site going live saw a suspicious POST to an application url that should have returned a 404. Upon checking, that file was a backdoor; it was timestamped the same time as the rest of the files. So it is safe to assume that the site came to us backdoored (other backdoors had newer timestamps). So I've trolled the log files and scanned the dirs and found the backdoors.

We'll be setting up a new account for this site and moving over the clean files. I'm still confirming with the old admins, but it would appear that they thought the hack was confined to the 'blog' (WP) and hadn't checked the main site app for malicious-ness...

If your server has been compromised, then assume they have root access. Even if it appears that you removed offending shell scripts (which a lot of times is all the "clean up" entails), it's entirely possible for them to dig deeper into the system. You have no idea what exploits exist for the server software, so it's entirely possible that uploading a simple php shell script could lead into a complete compromise of the OS or worse.

You are correct that 000 permissions would only allow a superuser (root is, by default, a superuser) to make changes to that file. However do note that a non-superuser could delete the file and upload their own copy in its place as long as they have write+execute permissions to the directory containing it.

As to why they might do this, it really depends on context of the file in question. Largely, it could be broken down into two categories:

The file is meant to be blocked and left alone.

This would likely be to cause a Denial-of-Service to whatever depends on that file.
This could also be an attempt to quarantine the file, without necessarily deleting it. Then, the superuser could safely open the file (read) to investigate it, send it to another service for analyses, etc...

The file is meant to be blocked for now.

With superuser rights, the attacker could later change permissions to execute the file.
Without superuser rights, the attacker could later delete the file and replace it with their own.

Realistically speaking, I have doubts they would re-hack you in the same obvious ways if they had deeper penetration of your server. On the flip-side, we have no idea what kind of concoction of exploits they have available to them on the second go-around, or in the future while they still have access. Therefore it is safer to assume the worst-case scenario until proven otherwise.

While we can make guesses as to why we're seeing this specific behavior, I don't feel it worth your time to personally investigate it. Contact your hosting provider, let them know what happened (aka what you described to us here), and let them investigate it. They could have additional logging/auditing available to them, and if all else fails, they could take the standard LOIC approach to compromised systems.


Can I replace username and password with a long random text in URL? Scenario

One customer is facing a problem with his users: they use a (web) service a few times per year and they forget their credentials very often. There is a standard password recovery procedure but many of them simply call customer service every single time (asking them to generate a given password). This has few bad implications:

Customer service staff knows all their passwords.
Users keep customer service busy (and when it's not working time these calls are expensive for customer).

Note that:

Users can change their own credentials to something meaningful but they simply don't care because they use this service only two or three times per year so they want to get things done as quick as possible.
To add a "remember me" checkbox is not an option because it's (in this case) prohibited by law.
Site stores very sensitive medical information.
Customer wants to save money so hardware devices (such as smart-card readers and/or fingerprints readers) are not an option.

Question

To solve these issues the customer is asking me to generate an unique ID for each user, this ID may be added to the URL to automatically authenticate that user. For example:

http://www.example.com?user=abcdefg12345

Users may decide to save this ID where they prefer (link on desktop, browser favorites, write it down on a post-it) but the customer himself is not responsible for that (remember we can't provide a "remember me" feature because of law).

I'm not talking about an authentication token (stored as cookie instead of username+password tuple, like discussed Why use an authentication token instead of the username/password per request?) but an URL parameter.

Assuming:

This auto-generated token is long enough (let's say 30~60 characters) and sufficient random (mixed case alphanumeric string).
Basic security measures are used (very long delays for unknown tokens and IP blacklisting).
I'd store these IDs separately from normal credentials, hashed (of course) and with a different algorithm/parameters than passwords (because of its length it may even be simpler or do I still need Bcrypt?!)
Parameter is removed from the URL after authentication and user is redirected.

Is there any other security concern that I don't imagine? Does this make authentication too weak?

Possible issues I can think about is that URLs are stored in browser history...

EDIT

Little bit more context: customer would keep his own list of fixed (not changeable) tokens associated with users. Just before they need to use his service he would send them all an e-mail with mentioned link (batch generated e-personalized e-mails). In my example the protocol is HTTP but in reality it's HTTPS (even if I don't have any control over this).

Additional question: Will making this token temporary help? Each time a new e-mail is sent then a new token is generated (with a relatively short expiration time, one or two weeks).

Even though the entropy in a large random token suggests that the token would be a secure mechanism of authentication, there are many problems associated with it:

The token is fixed per user, so a user can't change the token if they suspect it is compromised.
The token could be used unlimited times, which increases the opportunity for compromise.
Based on your description, the customer may know the tokens for his or her employees. While the data may be the same (or have the same access restrictions) for each account the customer manages, this compromises non-repudiation. The customer could use an employee account and no one would be the wiser.

There is a Process Problem

As you have pointed out, having customers call customer service to change a password has two significant problems:

First, it is inefficient for your business, and is costing your business and your customers money.
Second, it is dangerous from a security perspective.

Consider how allowing customer service to reset passwords affects the application security:

Any customer service representative can reset the password (and based on how you describe it, actually set the password) of any customer account, and can therefore access the confidential information of that customer's account.
Depending on the procedures for the phone-initiated password reset, the process could be susceptible to social engineering.

Use the Random Token to initiate a Password Reset

Customers who need to change their password should use the existing web application to request a password reset. This could ask for an email the account is registered to, and optionally, a set of security questions (depending on your own risk assessment). Next a password reset link with a random token is emailed to that email address. This link should only be valid once, and should expire after a short time if not used. When the user clicks the link, they are authenticated. Most web apps will have the user set a password at this point. In your case, you may want to allow the user to skip setting a password, since they will forget it anyway.

Customers who call customer service to reset their password should be instructed to use the password reset feature. The customer service rep may remain on the line and walk the customer through the procedure, but the key point is that the customer does the reset themselves. Once a customer resets a password themselves, they are less likely to call in again.


What are the possible solution for blocking VPN connection on a home network? I am not a techie. I am just wanting to force some parentral control using OPENDNS. Opendns works fine however it is easily broken on android or windows using vpn software like ultrasurf or latern or securitykiss.

I spend some time to found that most of these technologies use port 80 and 443 which is used by most sites and if I blocked them the whole internet is blocked.

one solution that I found but I can't dare to apply is using sophos home network firewall, however this technology need a whole separate dedicated computer to control the network.

So my question is, is there is any software with password or a way on the router to block vpn connection on the whole network and not just one device?

This is a classical mistake: solving a policy problem with technology.

Your case is exact the same as every systems administrator trying to protect his corporate network from users using VPN and tunnels to avoid the corporate proxy. No matter how many tools and techniques you implement, there's always one obscure way to avoid the locks.

The foolproof solution is policy. You (and the sysadmin) must create and enforce a rule stating that VPN use is forbidden, users caught will be punished, and what is the punishment. In your case, losing physical access to a cellphone/tablet/console is enough.


How to prove my identity by GPG signature on a file? It's a common need to prove that a file is truly created by someone, and I think GnuPG did the job. However, anyone can generate a gpg key with an unverified email. GPG key servers doesn't verify my email address at all. Is there any CA that provides identity validation like signing a HTTPS Certificate does?

You can either go to a certificate signing party or get an X509 certificate for you PGP key and get it verified by a CA trusted by all parties involved.


Does this mean Target's twitter was successfully attacked? I was just surprised to see this suspicious promoted tweet, asking me to send Bitcoins

I added the hand-drawn red lines so I am not responsible for propagating the apparent scam.

Clicking on the user name seems to take me to the genuine Target page with the verified checkmark.

Clicking on the link to the tweet (i.e. "40m") gives me an error that the tweet no longer exists.

Clicking on the URL goes to a page that looks like the screenshot, and a list of transactions.

Is it fair for me to conclude: Target lost control of their Twitter account to an (internal or external) scammer, who is ripping off people who think they are having a give-away?

Is there another way their username could appear advertising a scam without access to their Twitter account credentials?

Yes, Target did have their account hacked. In fact, quite a lot of verified account holders have been hacked to further this scam. The scammers do this to impersonate other accounts, including Elon Musk's, by changing their name while retaining their verified status. In this case, it just looks like the scammer is using Target's account directly. This scam has made the hackers over $150,000.

The Elon Musk scam is the most well-known now, but it appears Target was caught as well.


What are the differences between the RSA, DSA, and ECDSA keys that ssh uses? In my /etc/ssh/ directory, I can see three that I have three different types of ssh keys:

-rw------- 1 root root    607 Oct  4 22:43 ssh_host_dsa_key
-rw-r--r-- 1 root root    623 Oct  4 22:43 ssh_host_dsa_key.pub
-rw------- 1 root root    241 Oct  4 22:43 ssh_host_ecdsa_key
-rw-r--r-- 1 root root    194 Oct  4 22:43 ssh_host_ecdsa_key.pub
-rw------- 1 root root   1602 Oct  4 22:43 ssh_host_rsa_key
-rw-r--r-- 1 root root    378 Oct  4 22:43 ssh_host_rsa_key.pub

What are the differences between ssh's RSA, DSA, and ECDSA keys, and do I need all three?

Please explain difference between them and how use them.

What are these files for?
These are your host keys uniquely identifying your host. When OpenSSH is started for the first time, it will generate these keypairs. When an SSH client connects to your server, it will advertise that it wants to authenticate the host using a particular algorithm. As several are supported, OpenSSH simply generates one of each type. This allows your server to be identified with multiple types of fingerprints.
Taken from the OpenSSH man page, ssh(1):
When connecting to a server for the first time, a fingerprint of the server's
public key is presented to the user (unless the option StrictHostKeyChecking
has been disabled). Fingerprints can be determined using ssh-keygen(1):

    $ ssh-keygen -l -f /etc/ssh/ssh_host_rsa_key

If the fingerprint is already known, it can be matched and the key can be
accepted or rejected. If only legacy (MD5) fingerprints for the server are
available, the ssh-keygen(1) -E option may be used to downgrade the fingerprint
algorithm to match.

The files that end in .pub are not sensitive. They are transmitted to any client that attempts a connection. The files without that extension are the private keys. If those are disclosed, anyone will be able to impersonate your SSH server to any client. The private keys are used to prove to the client that the public keys being transmitted are in fact owned by the server.
When connecting to an SSH server, a series of events take place:

The SSH client connects to the server and advertises its preferred algorithm.
The server sends the desired public key to the client, if it is supported.
The client calculates the fingerprint of the public key.
For the first connection, the public key is saved to known_hosts.
For subsequent connections, the fingerprint is compared against the saved one.

On the first connection, the fingerprint is displayed to the user and the user is prompted to accept the fingerprint. This is known as TOFU, or Trust-On-First-Use. On subsequent connections, the fingerprint is verified silently and automatically. If there is a mismatch, the SSH client will refuse to connect and will warn the user that a MITM attack may be occurring. This behavior ensures that all future connections are genuine as long as the first connection is genuine. A MITM attack, or the SSH server changing its host keys for whatever reason, will invalidate this and require re-authenticating.
Which files do you need?
You do not need all three and you can remove any of them, but an SSH client will only be able to verify your server's fingerprint if it has a supported fingerprint stored in the known_hosts file. At a minimum, the RSA keys should be kept. Not every client supports ECDSA, and (EC)DSA has some security issues and is generally no longer recommended. There is no downside to keeping them all, though. A quick summary of the commonly available algorithms from a security perspective:

RSA is well-regarded and supported everywhere. It is considered quite secure. Common key sizes go up to 4096 bits and as low as 1024. The key size is adjustable. You should choose RSA.
DSA is not in common use anymore, as poor randomness when generating a signature can leak the private key. In the past, it was guaranteed to work everywhere as per RFC 4251, but this is no longer the case. DSA has been standardized as being only 1024 bits (in FIPS 186-2, though FIPS 186-3 has increased that limit). OpenSSH 7.0 and newer actually disable this algorithm.
ECDSA is newer and is based on DSA. It has the same weaknesses as DSA, but it is generally thought to be more secure, even at smaller key sizes. It uses the NIST curves (P256).
Ed25519, while not one you listed, is available on newer OpenSSH installations. It is similar to ECDSA but uses a superior curve, and it does not have the same weaknesses when weak RNGs are used as DSA/ECDSA. It is generally considered to be the strongest mathematically.


Tokenization - Is it bad practice to reuse tokens? If I am implementing a tokenization system for PII within a database, is it considered bad practice, or riskier, to reuse tokens?

For example, if I am storing the name "Richard" multiple times, and they are all replaced with the token "Fxyw3Qq5yzXqDoiKqx", does that then introduce any additional risk, than if I were to use a unique identifer for each "Richard"?

Yes, it introduces risk, but might be required, depending on what you're doing with the data.

Imagine a database of lots of people. Perhaps it includes names, addresses, and dates of birth, but the dates of birth aren't encrypted or tokenised, to allow for easy sending out birthday reminders.

If an attacker who steals the database can identify the name associated with a given date of birth (maybe they are on the system, so know their own name and DoB), then they can now also identify anyone else with the same name. They still can't identify the associated address, but they may be able to start correlating data - looking for people whose dates of birth are known with the same first name, for example, aiming to discover the token which corresponds to common surnames. By repeating this process (which is laborious, depending on the data, and whether details can be reliably cross-referenced), they can build up more and more information about the contents of the database.

If the tokens are really encryption, they might also be able to find patterns which help reveal the encryption key, if the designers haven't implemented the encryption carefully - in some cases, this means that by identifying a single longer value, an attacker can decrypt any other shorter value in the system.

If, on the other hand, you use a unique token for each instance of the same name, an attacker can't perform that cross-referencing process. However, neither can you - if you wanted to extract all the records for people called "Richard", you would need to be able to recreate every token to compare against your search term, which could be a difficult process, or even impossible if the token generation process involved a one-way hashing step.

Basically, if you want to be able to search the data afterwards and get correlation of data, you probably need to consistently tokenise the same value to the same token. If you want to fully anonymise the data, perhaps to provide it to a third party for testing or where analysis is being performed on non-PII elements, it's safer to ensure each instance of the same value in the original data is distinct once processed.


Sensitive files in the Cloud: Automated mounted TrueCrypt volume My current setup

currently I'm using Boxcryptor Classic 1.x (still compatible to EncFS) to mirror some files with SyncBack Pro into the virtual Boxcryptor-Harddisk. Those get then encrypted by BC directly into C:\Dropbox\BoxcryptorTarget. The passwords to the EncFS volume are stored within Boxcryptor, so they have to be stored somewhere (maybe windows registry or something) locally on my computer. I don't want to re-enter it. I think this is not really a big deal, as this PW is not used anywhere else and should only avoid that someone eventually breaking in the Dropbox-Servers should not be able to decrypt files. I mean, if he gets access to my computer, I have problems anyhow... :-)

Things I don't like about the current setup

Now what annoys me a bit about using BC this way are those things:

EncFS is not the "newest" algorithm and I read some things about it that it has some flaws
When mirroring many many small files, Dropbox sometimes gets stuck slightly
The software is still proprietary, even though it is at least compatible with EncFS which makes me more comfortable regarding security. But still, this does not say it couldn't contain backdoors or anything else.
Apart from that, I'd love to use a more "powerful" encryption algorithm to make me even more comfortable about putting private files in the cloud, I'm a little bit paranoid but still love the backup-abilities here.

How I'd like to change my setup

As Dropbox supports synchronizing only the changed parts of TrueCrypt Containers, I thought about using a batch-script to mount the container file before mirroring files with SyncBack Pro, and then using another script to dismount after mirroring. This way, I would have ONE big container file, i.e. Dropbox would not have any problems synchronizing thousands of small files. Besides that, TrueCrypt is open source with a full source code audit and I could even use some cascades, i.e. AES-Serpent or anything... Performance is not the main goal when it comes to cloud-security IMO.

And here comes the question now

When I'd use the TrueCrypt workflow, I'd want an automated solution, that means, I'd need the batchfile to contain the password for the TC container file to mount it right before mirroring with SyncBack Pro. Is this a security flaw, compared to using Boxcryptor the way I currently am using it, when I put the TC-volume password right into the batch file which I'm using to auto-mount the volume before mirroring files? SyncBack Pro runs as elevated process to be able to mirror even "locked" files, so I could also make the batchfile only readable by admin-users, so that no other "simple" executable without elevated rights could read its contents. I know you should never save the PW plaintext, but I guess BoxCrytor and similar solutions also do it this way when storing the PW within the program so you don't need to re-enter it...?

Maybe I could also save the command-line instruction directly within SyncBack Pro instead of using an extra batchfile...

But as I said in the very first paragraph - I'm not really seeing the saving of the password as critical in that case, as someone breaking into my system would have won the fight anyhow...

Thanks in advance

Storing the password on a script is not recommended irrespective of which ever technique you may be using. One work around would be to store a random file on a flash drive and  use it's hash (or value from it) as the password.  So that you can remove it when not in use.


API Security(APIs to be exposed to a specific client) We have microservice-based architecture.
Currently, we have APIs which we have exposed over the internet for all users.
Now we want to provide APIs to a specific client and only this specific client should be able to access this API.
What security practices we should follow? I mean what is the best way to secure such APIs. Provide a token to client and hard check for API with token on each request oy anything else?

what is the best way ... ?

It depends on what you mean by "the best":

The quickest to implement?
The cheapest to implement?
The easiest to integrate with Google or Facebook authentication?
The easiest to integrate with clients own authentication system?
A solution with the quickest way to revoke permissions?
The most resistant to a particular attack type?
The easiest for problem analysis and support?
...

Giving access based on some physical aspects (e.g. VPN connection, source IP) may be hard to implement and to maintain. That's why I'd suggest you to consider some authentication system based on user credentials, for instance, based on user/password (or depending on your context you may use client authentication based on user certificates, or based on user hardware like smartcard, or other).
Then you can implement authorization. Based on user (user name or some token), service should decide if particular request should be executed or not.
Without knowing particular context it is hard to suggest anything more specific.


How does X-XSS-Protection: "0" affect the security of my website? How does disabling XSS protection affect my website? What security vulnerabilities does it open? My site requires the header to be used on certain pages, so what can I do to secure the pages with the header? (try-it editor)

If you disable XSS protection via header, the attacker will be able to inject victim some code into your site if you use dynamic site with inputs where the risk has not been mitigated another way. You can get more information about XSS attacks on Wikipedia

If you want to mitigate this risk and do not use the header, you must secure every single input by methods like htmlspecialchars($value); (in PHP). More about mitigating XSS on W3Schools


Is it generally safe to disable Windows 10 Proxy Auto-Discovery Protocol (WPAD)? Is it generally safe to disable Windows 10 Proxy Auto-Discovery Protocol (WPAD)?

This might be my only option to try before contacting my ISP which could be quite annoying to do.

Overview of WPAD:

The Web Proxy Auto-Discovery Protocol (WPAD) is a method used by client devices to locate the URL of a proxy configuration file (e.g. a PAC  file) that is being hosted on the network, using either DHCP and/or DNS discovery methods which differs based upon the browser.

Once a proxy configuration file has been detected and downloaded the browser is configured in an appropriate way to either send web requests via a proxy server, or to bypass the proxy all together and send the web request straight to the web server.

Answer

The main point to understand here is why you are looking at disabling WPAD. From a security perspective unless you operate on a network that utilises WPAD and a Web Proxy (unlikely if you're not on an enterprise/business network) there would be no harm in disabling WPAD within each of the browsers that you use.

Based on the questions which you are trying to follow on from I'd take a guess in saying this isn't an area you need to troubleshoot further and the cause of your problem is likely to be elsewhere.


How to ensure security in desktop application using WebSockets locally? I am developing an application containing both Python backend and frontend using Electron. There is no authentication. The two components communicate through WebSocket. How should I prevent the third party from connecting to the port?

You need to be able to distinguish between the trusted client and the untrusted third party in order to block the third party. This means that you somehow need to find out when the trusted client connected and when the connection does not come from the trusted client. This means you need some form of authentication but it does not need to be some setup with users and passwords or similar. How this authentication is done depends on your specific setup, i.e. it might simply be a specific IP associated with the correct client, it might be a token only the trusted client knows, it might be authentication based on a certificate (i.e. mutual authentication in wss://) etc.


CSR signing follow up question This is a follow up question , after getting a signed certificate from one CA.

researched a lot , but no luck. After getting the CA reply,
While downloading the certificate, it popped up saying "creating a private key” with passphrase.

Why it’s asking to create a private key? What is its use? (say PK1)
While creating the CSR, i already had the private key (SAY PK2). Are PK1 and PK2 same?
Someone from CA can also get it, like i did, so how it’s not vulnerable to attack?

I completed the wizard, and downloaded the certificate with PK1.

I referred all the possible below links but not getting above answers

Previous question link - previous post

UPDATE 1

UPDATE 1

researched a lot, to find the answers of question posted but no luck. I am getting stuck at this point, is the signed certificate from CA also has a private key or its only a public key ? As far as i got "A P7B/pkcs7 file only contains certificates and chain certificates" which we need to import as "CA reply" in out keystore.

The basic protocol for getting a singed certificate from a CA is the following:

Requester generates a key pair (a private key and a public key)
The private key is put aside and should never leave the computer
Requester generates a Certificate Signing Request (CSR) which contains basic information that will go into the final certificate (Distinguished Name, Country, ...)
Requester submits the CSR to the CA which will verify it (eventually contact the requester to establish it's identity)
When the CA trusts the CSR belongs to the identified person, the CA will issue a certificate which is basically the CSR signed by the CA's private key (plus some information to track the signature back to the CA)
The requester can now use the certificate which embeds it's public key signed by the CA to establish communication with clients.

So when importing the signed certificate, you should not have to create any private key (you should already have it). It is also good to know that many program managing key generation will also propose to put the private key into a secured file. This file will be encrypted (AES probably) with a passphrase you should supply.


PHP security hacking question, may be more than just PHP I have an input box for for INSERTing into the database. It is written in PHP PDO. Some one typed in:

<"'>

and also:

' onClick='alert(1);

I'm assuming they were in two different input boxes. But somehow, the user was able to modify the a field in the database to a negative number when the only way (if doing it right which is by pressing a button) is to increment by +1 or -1. For example, user presses the "+1" button, it will +1 in the database. If they press "-1" in the database. They have a negative number of -50 or something like that. What could they have done? What is my website vulnerable of?

Here is the code:

$insertQuery = $dbh->prepare("INSERT INTO fcomments (poster, lid, post_id, comment, time_stamp) VALUES(:user_id, :lid, :post_id, :comment, :timeNow)");
$insertQuery->bindParam(':user_id',$user_id);
$insertQuery->bindParam(':lid',$lid);
$insertQuery->bindParam(':post_id',$post_id);
$insertQuery->bindParam(':comment',$comment);
$insertQuery->bindParam(':timeNow',$timeNow);
$insertQuery->execute();

It looks like all the values are binded. Not sure what could be the problem?

Your code handles the SQL insertion correctly. I have two guesses about the attack:

The attacker could have repeated the request several times, and your code doesn't check if it has already downvoted the post.
The attacker have sent a lot of downvote requests in a very short period of time, allowing him/her to exploit a time of check / time of use race condition.


Open source solution to capture and decrypt SSH traffic (with private key)? I am looking for a free open source solution that is able to capture and decrypt SSH traffic given the fact that I can provide the server's RSA private key (something like SSH CryptoAuditor).

Please advise.

mitmssh is the only tool I'm aware of capable of MITM'ing SSHv2 sessions.  If you're looking for after-the-fact capture decode, that's not possible, as SSH universally uses ephemeral key exchange mechanisms.


Malicious 'specially crafted' MP4 file I came across CVE-2019-2107 that says

  ".... With CVE-2019-2107 the decoder/codec runs under mediacodec user
  and with properly "crafted" video (with tiles enabled -
  ps_pps->i1_tiles_enabled_flag) you can possibly do RCE."

Now after googling for a whole night, I still don't know HOW a malicious guy can "craft" this video file.

I tried to open the POC mp4 from the github repository of the researcher with OllyDbg, but it's a bad idea because the file is in mp4 format.

My questions are:

How he could "craft" such file, with what IDE or language?
How can I reproduce the POC based on the published one from github?
How can I reverse engineer the MP4 POC?

I am looking for answers that give me an entry point to conduct research.
I think this will help me in my university project, because it's a new and unique thesis.

All files are just a string of bytes. An MP4 file means, depending on who you ask, a string of bytes that conforms to the MP4 standard, or that an MP4 player can do something with, or that has '00 00 00 18 66 74 79 70 6D 70 34 32' as the first twelve bytes (many file format standards always start with some fixed string of bytes so a program can look at just them to tell what kind of file it is. This is called a Magic Number). In principle you could craft a valid MP4 file with a hex editor, just typing in the bytes one by one, but since the MP4 standard is pretty complex it would be a lot of effort.

In the context of crafted exploit files, an MP4 file is one that the target MP4 player will read and say 'this is an MP4 file', before trying to process it. That might mean it has the magic number, or possibly just the extension '.mp4'. It can be crafted in any way you might create an arbitrary file, but probably by either modifying a program that creates mp4 files or taking a valid mp4 file and modifying it manually in a hex editor. Most crafted exploit files aren't actually truly valid but rather just pretending to be MP4 files (or whatever).

so,
1) He could craft it using any method of writing bytes to a file, but in practice probably did it by modifying something that produced or was a valid MP4 file already.

2) You can reproduce the bug by trying to play the poc file on a vulnerable android version (Android-7.0 Android-7.1.1 Android-7.1.2 Android-8.0 Android-8.1 Android-9. Android ID: A-130024844 apparently), or otherwise in an environment where it will be processed using a vulnerable version of Android Video Player.

3) You could put the vulnerable software in a debugger and see exactly what happens when you feed it hvec-crash-poc.mp4. Note that OllyDbg won't help you here, you need a debugger that works in an Android environment while OllyDbg is Windows-specific. From the screenshots on the GitHub page it looks like he's using GDB. I don't work with Android much so don't quote me on this, but I think the vulnerable software in question (Android Video Player) is a system service that you'd have to attach the debugger to, this will require a rooted Android (or Android emulator).


Can I put the session token in the body to protect against CSRF? Say I have a user with an associated session token. This user wants to delete his account, and so he goes to its associated link. I, trying to protect my users and myself from CSRF attacks, have it so when the user clicks a link and makes the DELETE request, I send that user's session token in the request body. Any other sites couldn't possibly know the session cookie, and therefore couldn't send it in the request body. On the receiving end, the server checks to make sure that the session cookie and the session token in the body are the same.

Why doesn't this work? The explanations I've heard have been way more intricate and I just can't see why the aforementioned process wouldn't work. I know I must be overlooking something!

Basics of CSRF protection

Most CSRF protection mechanisms work on a basic principle that the HTML form being submitted and the server should have shared secret between them. When the form is submitted to the server, this shared secret is used to identify if the request originated from a legitimate page. There is no way for malicious sites to access this shared secret if it is present in the request body. (Obviously cookies cant be used to store this secret as browsers transmit them to the target domain irrespective of the origin of the page.)

Double submitted cookie

The prevention method that you have described is called double submitted cookie. In this the shared secret is sent using both the cookie and form parameter. The server only has to compare the two values to filter out forged requests.

Why does it not work?

It does work. The session token is indeed a shared secret between the browser and the server. However the session token's primary job is to track the user's authenticated session. A session token present in the cookie is protected by cookie flags such as HTTPonly. This prevents JavaScript from accessing the session cookie, which in turn prevents session ID theft in case of an XSS vulnerability.

Having the session token in the request body of every HTML form increases the attack surface as the session token can be extracted by exploiting a script injection vulnerability. Hence it is good practice to have a dedicated CSRF token do the job.


Trying to identify what a scanner was looking for I got scanned yesterday, and I'm seeing a bunch of entries in my logs like /'\"\\'\\\");|]*{%0d%0a<%00>/photos or /'\"\\'\\\");|]*{%0d%0a<%00>/resources. What specific vulnerability was this bot looking for?

The next thing was a bunch of requests for urls like /1%c0%00xa7%c0%a2/about. Not sure what vulnerability was being tested for there either.

The first line is a HTTP response splitting attack, %0d%0a is a CRLF, it is trying to generate 2 responses for the same request: http://en.wikipedia.org/wiki/HTTP_response_splitting

The second line is a path traversal attack like people already mentioned. The characters there are unicode representations of backslash that would make an attack succesful is your site was vulnerable.


Best Practice for MFA on Root AWS Accounts I would like to enable multi-factor authentication on my organization's AWS root account, however I'm unsure of the best practices on how to do so.

We already have separate IAM accounts for each person needing access; most every account is extremely limited in permissions but several of us have full administrator access via IAM. Requiring MFA for each user's IAM account is easy since they can all setup Google Authenticator or Authy on their personal devices. However doing the same thing to the root account seems unwise, since it would limit access to a single person (which isn't very bus-proof). A couple ideas I've had are:

Enable MFA and have 2–3 admins scan the QR code (for the root account) at the same time.
Create a shared Authy account containing for this purpose and record the password somewhere secure that an admin can access it if needed.

Is there a best practice for doing this or another option I'm missing?

Here's how I wrote up a solution to this:

The Vault product from HahsiCorp allows you to log all access to any credential, and it supports TOTP hashes in such a way that it'll permit you to read the current value but not the secret key. To use root access, get the current token from Vault.

To ensure that you don't lose access, make good backups. To ensure that your backups aren't compromised, split the master decryption against the appropriate number of individuals in your organization and encrypt that to PGP keys on hardware token.

In this way as long as a Vault instance is running, any authorized person can use the root credentials and you'll know who did. Actually getting the root MFA secret would require collusion among multiple people.


Can skeuomorphic UI design create security vulnerabilities? Skeuomorphic design is common in desktop computer and mobile telephone applications. Sometimes interfaces and cues from the real world are used to good effect (swiping to move backwards and forwards in a eBook) and sometimes to terrible effect (rotary dials that need precise circular mouse motions on oscilloscopes).

Whilst these often cause limitations and problems in terms of usability and accessibility, are there any examples of skeuomorphic design leading to a security vulnerability?

An example I can think of - most intruder alarm panels use numeric keypads (with some special keys) and limited size (2 rows x 40 chars) LCD displays. This limits both input (limited alphabet for codes) and the output (status updates are often like "ZN 3 INPT OMIT"). If a mobile phone app to control the alarm mimics the panel exactly, we are still constrained by the same limits.

Skeuomorphic design is tempting: To differentiate a product from its competitors; but at the cost of reinventing the (UI) wheel and creating absurd learning hurdles for users. No website should be so unique as to exceed a user's motivation to learn how to use it.

For security, there are few consequences of using skeuomorphic design (especially where skeuomorphism isn't the de facto UI element):

Loss of information: The chrome of Skeuomorphic UI reduces or prohibits visibility of important security context information for the user. For example, a web browser pretending to be a "racing car windscreen" or Tron-style virtual world hides the website address as "too 2D/old skool" and not "skeuomorphic".
Drowns out high priority information: The security information might be visible on the screen but camouflaged as an innocuous UI element. For example, a remote gardening program displayed as a planet nursery could have connectivity errors and warnings displayed as a cutesy wilted pot-plant. The information was there but not especially modal or explicit.
Culturally ambiguous: Translating security and safety text between languages is hard enough, skeuomorphic design assumes the underlying product ever existed in that culture. For example, a red bulb on a skeuomorphic internet radio application might mean something quite different in non-western cultures.
Hard to navigate: Most skeuomorphic applications are only visually skeuomorphic, with none of the ease and speed of use of the original 3D object; this can result in mistakes or delays that can have serious consequences in quick-reflex/high-security scenarios. For example, checking the current fuel level of car shouldn't involve dragging a visual dipstick in and out of a tank on a touchscreen.
Can not use pre-tested third party libraries: Each skeuomorphic application has custom UI otherwise why bother? Hence the security of the interface layer does not benefit from the "many eyes - shallow bugs" effect of common third party resources. For example, your checkbook application looking like a physical checkbook instead using international standards for checking information.
Difficult to audit if business logic in UI: No idea if the application is leaking information it shouldn't. Security auditors have to learn each application's custom UI to review it. For example, when website UI conventions did not exist, the pi symbol in that The Net movie was plausible on website front page.


How are full URLs exposed when they are encrypted by HTTPS? As far as I know, HTTPS URLs are encrypted (correct me if I'm wrong). There was a data leak recently and in one article about the leak I saw this picture:

If HTTPS URLs are encrypted then how did the ISP log the full URL (notice "fw-url")?

The article states that:

  a connection was discovered to a web filter app built by Conor [Solutions]

Given that it was a web filter, and given that it was able to log URLs, we can infer that this was a Man-in-the-Middle (MITM) proxy which decrypted the requests, filtered based on the unencrypted request, and then re-encrypted and forwarded the request to the actual destination.  And unfortunately, it logged these requests, and that log got compromised, thus the leak.

This sort of MITM would require a CA certificate be installed on the client so that the proxy could present certificates for each web site visited.  Presumably Conor Solutions had some way to roll this change out to customers; perhaps there was "filtering software" for customers opting into having web filtering as a package.


SSH Proxy vs VPN Killswitch This might be complete nonsense but I've heard people talking about so I'm interested to see if it's valid: I've heard people saying that SOCKS and SSH are more secure/private than a VPN because they rigorously enforce a killswitch if the SSH connection drops (whereas, by default, if a VPN connection fails, the computer starts to direct traffic in the clear). Is this valid and, if so, are there servicrs that provide this (similar to a VPN service), is there away to strictly enforce all traffic to be routed through this SSH SOCKS proxy tunnel, and is there a way to set this up that also prevents DNS leaks?

Sorry if this makes no sense, and thanks!

There's no way to enforce all traffic via socks proxy. You would be better with VPN.

You can configure system to not connect to the internet if not on VPN connection, Linux for example has such tickerbox to enable it without hassle. It can also be done using firewall and routing. It depends on what OS you are using and what VPN.

Using routing for example, you configure only routing to your VPN router and do not configure default gateway. This way, default gateway is setup only on VPN connection. Also to prevent DNS leaks, you configure DNS to 8.8.8.8 so it works only via VPN default gateway. In this simple way you can do it with VPN.


SQL injection possible with hidden GET parameters? I was asked by my friend to play around with his family's new website and report any bugs I may encounter. Going through the pages, I noticed one that very much looks like it's prone to SQL injection. I do not have access to the source code as it is hosted by a local website design company.
http://website.tld/product/1234/a-beautiful-vase

After playing around with the URL, I was able to get the exact same page with:
http://website.tld/product.php/id=1234

I replaced 1234 with 1234' and the website threw the following error:

Warning: mysql_num_rows() expects parameter 1 to be resource, boolean given in /home/shop/public_html/product.php on line 34
Warning: mysql_fetch_array() expects parameter 1 to be resource, boolean given in /home/shop/public_html/product.php on line 40
You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near ''1234''' at line 1

I also tried replacing id=1234 with
id=1234 AND 1=1 (automatically encoded by the browser into id=1234%20AND%201=1) and id=1234 AND 1=2 (automatically encoded by the browser into id=1234%20AND%201=2). With both attempts, the web page succeeds to load the product page with two additional errors thrown:

Warning: mysql_num_rows() expects parameter 1 to be resource, boolean given in /home/shop/public_html/product.php on line 205
Warning: mysql_fetch_array() expects parameter 1 to be resource, boolean given in /home/shop/public_html/product.php on line 217

The product page looks normal with the product information, weight, price, and image all correctly populated. There is no SQL syntax error. And that's where I got a little confused.
I also tried a bunch of other variations:

id='1234%20AND%201=2 yielded ...to use near '1234%20AND%201'' at line 1
id=1234'%20AND%201=2 yielded ...to use near ''' at line 1
id='1234'%20AND%201=2 yielded ...to use near '1234'%20AND%201'' at line 1
id=1234%20AND%20'1'=2 yielded ...to use near '1''' at line 1

However, id=1234%20AND%201='2 also renders the correct product page with the two PHP warnings same as above:

Warning: mysql_num_rows() expects parameter 1 to be resource, boolean given in /home/shop/public_html/product.php on line 205
Warning: mysql_fetch_array() expects parameter 1 to be resource, boolean given in /home/shop/public_html/product.php on line 217

I guess my questions are:

Is it possible, in this case, to perform SQL injection? I found extensive tutorials online explaining how to inject normal GET parameters. However, if I'm not much mistaken, .htaccess is used to rewrite the URL so would that prevent (or change) the procedure?
Secondly, since the browser encodes special characters (for example spaces to %20), doesn't that mean MySQL will get something like WHERE id='1234%20AND%201=1 and cause a syntax error?
Why did it yield the same result even when I tried adding AND 1=1 and AND 1=2 at the end of the id parameter?
Why did id=1234%20AND%20'1'=2 yield ...to use near '1''' at line 1? I only put one single quote around 1 yet the error seems to indicate there are two additional single quotes after 1?
The web browser (I'm using Google Chrome) doesn't seem to encode the = sign, yet manually changing it into %3D doesn't seem to make a difference in the outcome. Why is that?

Two additional points I'd like to point out:

The PHP warnings thrown when there is an SQL syntax error and when there isn't are different, simply take a look at the line numbers. I'm guessing line 205 and 217 are queries used to find related products whereas the main query pulling up the id=1234 product is located around line 34-40.
id=1234%20-- renders the product page perfect with no error or warning at all.

I'll try to answer one question at at time,

  Is it possible, in this case, to perform SQL injection? I found
  extensive tutorials online explaining how to inject normal GET
  parameters. However, if I'm not much mistaken, .htaccess is used to
  rewrite the URL so would that prevent (or change) the procedure?

Yes, it is possible. Since the query is expecting to return one result, you can force the current query to return no results (check point 3) and then make a union with another table (for example the users table) and return a single row at a time.

  Secondly, since the browser encodes special characters (for example
  spaces to %20), doesn't that mean MySQL will get something like
  WHERE id='1234%20AND%201=1 and cause a syntax error?

No, the characters are only encoded in the url, when the String reaches the server it will be as if it wasn't encoded.

  Why did it yield the same result even when I tried adding AND 1=1
  and AND 1=2 at the end of the id parameter?

You're getting that error because the query is returning false, maybe because the way the query is constructed and you're not injecting on it right. For example when you say AND 1=2 you're making the condition false and no rows are returned. But better read this to understand better.

Try to put -- after, like id=1234 OR 1=1 --, to try to avoid that error.

  Why did id=1234%20AND%20'1'=2 yield ...to use near '1''' at line 1?
  I only put one single quote around 1 yet the error seems to indicate
  there are two additional single quotes after 1?

It may be the format for the database to return the errors, if you notice, in the other errors, it is adding '' in the end also.

  The web browser (I'm using Google Chrome) doesn't seem to encode the
  = sign, yet manually changing it into %3D doesn't seem to make a difference in the outcome. Why is that?

Look at point 2. When the String reaches the server it will be a = in any case.


How can I catch an Instant Messenger Identity Thief? Here is the scheme.

The identity thief logs in as my American friend in the instant messaging program QQ.  (Did he steal her password or use some other exploit? I don't know.)
The thief contact's my friend's Chinese mother and says that 'her' friend in China needs money for hospital bills. The thief claims that 'her' phone has fallen in water so the mother cannot call her daughter.
The fake daughter puts the mother in contact with the 'injured friend' (really the thief).  They chat in Chinese for a while, until she agrees to send the money.
The mother sends the maximum allowable amount by Western Union Transfer but becomes suspicious when when the thief asks for even more money.

I know that it is a long shot, but is there anything that I could do to try and find the scammer's identity?  Are there any mistakes he may have made that would help me to identify him?

The Police in China have already been notified, but the enforcement on these sorts of crimes is notoriously bad in China.  I want to at least make at attempt to track down this guy.

There has been some success by people in trying to 'con the con-artists' into giving away vital pieces of information about where they are who they are.
Depending on the legality of it, you could try and get them to execute a trojan on their PC (while playing along with their Con) and see if you can't get some information that way. It obviously isn't guaranteed to work, but maybe you can activate their webcam, get their personal information through Facebook or something.

If it all goes well, you can then potentially take that information to the police.

You might need to consult a lawyer first to see if this is legal in your country. I'm quite certain that in Australia this would not be allowed.

Please let us know how it works out for you and if the scammer is ever caught.

Hope that helps.


How exactly are registration authorities related to certificate authorities? In preparing for the CISSP exam, the course material seems to emphasize a distinct role between a Certificate Authority and a Registration Authority. As per the study guide description:

  Registration authorities (RAs) assist CAs with the burden of verifying
  users' identities prior to issuing digital certificates.  They do not
  directly issue certificates themselves, but they play an important
  role in the certification process, allowing CAs to remotely validate
  user identities.

Is this all an internal functional process/role that customers don't really see?   If I go to CA vendor "Widget Certs, Inc" and submit the CSR via the web site, it seems like this all gets processed by a singular entity.

To make things more confusing... the course material later states:

  When you want to obtain a digital certificate, you must first prove your identity to the CA in some manner; this process is called enrollment.

This process of enrolment is made confusing unintentionally.

In many cases the RA and CA are the same entity. An easy way to see this is with common SSL/TLS certificates. Godaddy, Comodo, and others will offer a EV SSL (Extended Validation SSL) Certificate. The corporation who offers the certificate, validates the end user's information as well as actually issuing them a certificate.

To create a full chain of trust, the RA and CA should be separate entities. In a system like ICAO's PKI for ePassports, this system is much more evident. There is a document signing certificate (DSC), a country signing certificate (CSC), and sub certificates for each issuing office in the country (issuer security certificates or ISCs). It's not very evident when inspecting the raw certificates in ICAO's PKI, but some countries do seem to follow this full model.

The immediate benefit of this "full" model is that a revocation list can target a specific issuing office's certificates, rather then one for the country.

You can read more about the PKI structure ICAO employs below:

https://en.wikipedia.org/wiki/International_Civil_Aviation_Organization_Public_Key_Directory

http://www.icao.int/Security/FAL/PKD/Pages/default.aspx


Assemble P12 from local cert and HSM private key pointer? I am using SoftHSM along with the OpenSSL PKCS11 library for the HSM and I can create certificates and sign so I know the interactivity is working.

I've created a certificate whose private key is stored on the HSM but I'd like to be able to create a .P12 file containing both the certificate's public key and the pointer for the HSM private key.

Does OpenSSL support this? The OpenSSL PKCS12 command doesn't have a parameter for -keyform so I can't tell it to look at the engine for the key pointer. I've also tried to extract the pointer to a separate file by using OpenSSL RSAUTL but that doesn't work either.

Ultimately I'm trying to get to the same behavior you see when using certificates from smart cards...ie you can import them to your local user/machine store and it shows you have the private key (even though it's just a pointer).

Thank You!

Highly doubt PKCS#12 supports that.

How do you expect the 'pointer' to behave? Some UUID that's recognized as existing on external HSM, and also identifying the HSM where it exists?


Is it secure: unsecured Wi-Fi + social network authentication to access the web? Recently I visited my dental office and noticed a Wi-Fi configuration I haven't seen before. First, there is unsecured (no password) Wi-Fi, but I cannot surf the web yet. I am redirected to a webpage where I see 2 buttons (Facebook and Twitter) to choose from for authentication in order to fully access the internet. I declined to click on any over the unsecured network. As far as I know, my activity can be sniffed while I am on such a network. On the other hand, if I am not mistaken, social network authentication is considered relatively safe. So the question comes, is it safe to merge those two? Is there a risk of my password being sniffed? I also think that it poses a risk on disclosure of personal patient data if that is stored in the same network.

One of the points of social media login is to avoid password entry by resuing your existing loggged-in state with the social media.

If you have not already logged in to the social media site in your browser, simply do that over mobile connection and then connect to this wifi.

Some social media may want to verify your password before you can approve an association, but they will almost always pre-fill the username and may even display your profile picture. This is currently not possible with normal phishing. And as always, check HTTPS and the domain in the address bar before entering the password.


Designing CP and CPS for multiple hierarchical CAs I am thinking about how to design and structure CP and CPS for multiple CAs build in a hierarchical manner and compliant to RFC 3647.

The structure of CAs in build from one Root CA to multiple subordinate CAs each serving different PKI service and certificate profiles:

Root CA --> CP0 and CPS0

Sub CA 1 --> CP1 and CPS1

issuing VPN certificates

Sub CA 2 --> CP2 and CPS2

issuing client certificates
issuing RA certificates

Sub CA 3 --> CP3 and CPS3

issuing certificates for authentication with custom extension

Sub CA 4 --> CP4 and CPS4

issuing certificates for devices

Sub CA 5 --> CP5 and CPS5

issuing certificates for payment cards
issuing certificates for payment authorization
issuing certificates for merchant access

etc...

Now I know what is OID and how to define CP in certificate together with URL to CPS. Currently only Root CA has defined "any policy" with OID 2.5.29.32.0. Every subordinate CA has its own definition of OID and therefore should have its own CP and CPS for PKI services it provides. But with growing number of Sub CAs it is really hard to maintain all of these CP and CPS.

What is the best practice how to handle complex PKI environments point of view of CP and CPS?

Should I start using OID on certificate profile level and not on Sub CA? And in that case create one or two CP with the definition of all OIDs related to certificates that can be issued?

In that case there can be one CP with:

CP --> OID1
issuing VPN certificates --> OID2
issuing client certificates --> OID3
issuing RA certificates --> OID4
issuing certificates for authentication with custom extension --> OID5
issuing certificates for devices --> OID6
issuing certificates for payment cards --> OID7
issuing certificates for payment authorization --> OID8
issuing certificates for merchant access --> OID9

So I can maintain only one version of CP and several version of CPS related to PKI services different from each other or also only one CPS for whole environment?

Well, your design makes some sense for me and may be valid. If each policy has its own unique procedures (defined in CPS), then you may need to create as much policies as many different policies are defined. Even if they operate under the same PKI Management Authority.

Your question requires some research to examine the procedures for each certificate type. For example, are there any difference between issuing VPN certificates and issuing certificates for authentication with custom extension? What kind of difference? Usually, most important difference includes (but not limited to):

The way how certificate applicant is authenticated (say, can request the certificate by email, or through face-to-face meetings and handsigning the document, requirements the applicant must meet, etc.)
The way how certificate is delivered and stored (say, the policy requires to store certificates on smart cards only)
Does the policy allow key recovery?
...

In other words, sections §4.3 and §4.4 can be different for a single PMA (the rest paragraphs are usually the same across all policies) and each set will require separate CP. Then, if two or more CAs operate under the same CPS (has no significant differences that may be critical to software where multiple certificates may be presented, but only specific are accepted based on a policy), then you can merge and assign the same CP/CPS to these CAs.

For example, it doesn't seem to have notable difference between CP1 and CP4. You may consider to merge them in one CP. CP3 makes very little sense in terms of CP. The fact that certificate includes some extra extension means literally nothing, because it (most likely) doesn't employ distinct practices and procedures. You may consider to get rid of this CP at all. CP2 may be merged with CP1 and/or with CP4. CP5 is the only policy that seems to require a separate CP, because these certificates falls (most likely) under highest insurance level and the most strict requirements.

When you examine all policies, you may end up with only two policies: CP1 assigned to SubCA1-SubCA4 and CP2 assigned to SubCA5 with corresponding OIDs (OID1 and OID2).

Regarding mapping between CP and CPS. You may create single CPS document and describe all policies in the same document. Like it was said, most sections (except §4.3 and §4.4) will be the same across all policies, because they operate under the same PMA. And provide separate §4.3 and §4.4 for each policy.

In addition, I would review entries for CP5. Each entry may have different policy OID. Certificates for merchant access and payment authorization may look the same, but there will be a software that will check whether the presented certificate falls under specified category (even though, they are issued under the same CP and CPS). Not sure how they are used in your environment.

Tip: you should not define Certificate Policies extension at root CA level. An absence of Certificate Policies extension on root certificate implies Any Policy for it. First Certificate Policies appearance should be at level 2 in hierarchy. Most likely, all CAs are under the same administrative control and don't require a separate policy for CAs. However, if root CA (or subordinate CAs) is outsourced, you may need to move to 3-tier hierarchy with dedicated Policy CA under root that defines the policy attributed to 3-level CAs.


How to detect Snort on the network? Does anyone know how to fingerprint an IPS ? is there any tool available to do the job?
I want to detect snort in my network .
Would appreciate any kind of help.

Configured properly, you shouldn't be able to detect snort.  "Properly" means on an unconfigured/no-address-assigned port in promiscuous mode.  As PTW-105 mentioned, if snort is configured to send resets then maybe you can detect it, but more likely, you'd detect that something was blocking you.  The same holds true if it's in inline mode.

Two things I can think of if you really wanted to know it was snort (as opposed to some other IDS/IPS) would be if 1) snort was configured to do logging to some other host and you were able to see that traffic or 2) you could send packets that you know would match snort's ruleset and if you have enough hits, especially for nonstandard stuff or if your packets were so specific that it would probably only drop on snort's detection, you could know that way.  But it would be noisy since you were intentionally setting off alarms and if snort was not configured in any sort of active blocking mode I don't know of any way of knowing other than a system that dumped alert data back on the wire in a place you were able to see.

Thanks,

~Patrick


Security for FTP connection within a server In PHP, I am accessing another user's files using FTP on the same server. In this case, do I need to use secure FTP or is it ok to have normal FTP as both source and destination are on the same server?

Adding after getting some comments and answers:
One website is accessing files of another website for some processing requirements and cloning. There is no permission issue. Both websites are under different users in linux so PHP code executing under 1 user cannot access files of another user for copying. Also, I am using FTP (which is already there on the server) because in future these websites may be on different servers. But now they are on same server.

Notes:
 - Both website users cannot be added to same group as this is the only time one website accesses files of another site. After that they should not be able to access files of one another.

This sounds like the xy problem.

But before I get into that.....

There are several reasons why FTP is generally disliked. Here, the number one reason will be that passwords are sent across the network in clear text - and hence easy to capture. But the (by default) separate data channel is also a pain to deal with on firewalls. If you are not crossing the network then you've addressed these issues.

But do you know for sure that this will always be the case?

A very simple tenet of Security is that you don't install/run software you don't need. Hence unless the host is already running a XXXX server for a very good reason, then adding one is bad for security.

If we are talking about Unix/Linux hosts, then they almost always be running an ssh server - which gives a lot of weight to favouring sftp/scp over ftp/ftps.

Almost as bad as sending passwords across a network is writing them, unencrypted to your filesystem. for your code to connect to sftp/ftp/ftps it needs a password or a private key. Anything which avoided this requirement would be beneficial to the security.

Which brings us to the real issue...

If your code is unable to read the required files which exist on the local filesystem then your permissions model is wrong. That is the issue you should be addressing.


Implementation of PMKID computing function I am trying to implement a function, let's say in Python to compute Pairwise Master Key Identifier (PMKID) after reading the previously discovered bug in WPA2. Googling gave me this logical statement:

PMKID = HMAC-SHA1-128(PMK, "PMK Name" | MAC_AP | MAC_STA)

However, the problem is i am not able to compute the right hash. I've tried various possibilities, tried converting data to binary, tried various versions of MAC but still no chance.

The Question is how do I implement the function for computing PMKID, preferably in Python. Here's what i've doing a bit:

import hashlib, binascii, hmac
from pbkdf2 import PBKDF2

print "Required hash: 2a416a999af0a6bf454684269afb06ef"
apmac = '34:bf:90:4a:bb:57'
clmac = '98:de:d0:1a:97:c2'
pmk = PBKDF2('786 5555', 'unknown', 4096).read(32)
print "PMK: "+binascii.hexlify(pmk)
pmkid = hmac.new(pmk, "PMK Name"+apmac+clmac, hashlib.sha1).hexdigest()
print pmkid

Your code is ok, but you need to put the MACs in hex:

'\x34\xbf\x90\x4a\xbb\x57' instead of '34:bf:90:4a:bb:57'


SSH - If Eve has the passphrase and public key, can she derive the private key? I have used ssh-keygen for creating an RSA 4096-bit SSH private and public key pair. I used a passphrase for the private key.

If an attacker, Eve, knows the passphrase in addition to the public key:

Can they derive the private key? - I presume yes with enough time.
If they can derive the public key, what algorithms can they use to do this? - I don't know.
What is the number (or order) of operations needed for each algorithm to derive the private key?

Update - it seems that with using "yafu" on one computer (http://iamnirosh.blogspot.co.uk/2015/02/factoring-rsa-keys.html) that the brute force cracking process / factoring takes significantly less time.

Would be interesting to see how much difference yafu makes on a distributed environment and on supercomputers.

The private key is unrelated to the passphrase. So is the public key. The public key is also generally stored unencrypted, even when the private key is protected by a passphrase. (Exceptions may exist where the public key is stored in an encrypted form, but in the basic case and assuming a sufficiently large key, doing so provides no additional security because the public key is meant to be publicly distributed or at least can be assumed to be available to an adversary.)

Now, don't get me wrong. Protecting your private key with a passphrase is a very good idea, and it is best practice to do so. The private key and the public key have a mathematical relationship to each other. But your private key is still just a number. This number is unrelated to the passphrase you use to encrypt the file that holds this number, which is all the passphrase does.

  If an attacker Eve knows the passphrase in addition to the Public Key; Can they derive the Private key? - I presume yes with enough time.

The public key is mathematically related to the private key, and the simple answer is that yes, with sufficient time, in theory, one can be derived from the other. The public key almost by definition needs to be transmitted in the clear in order to establish an identity before the encrypted communications channel is set up, so Eve (by convention Eve is a passive eavesdropper; Mallory is an active man in the middle) can see it.

Deriving the public key from the private key in RSA is easy. Deriving the private key from the public key is supposed to be computationally infeasible, and with sufficiently large keys effectively impossible. So far as we know, there is no fast way to derive the private RSA key data from a 4096-bit public RSA modulus on a classical computer (which is what we currently have). Even an efficient attack on a 2048-bit public RSA modulus would be quite a feat, though 1024-bit RSA is within the realm of possible in reasonable amounts of time and a 768-bit RSA private key has been factored in public (it took the equivalent of on the order of 2,000 CPU-years on reasonably modern hardware).

So, "with enough time", it is possible. But that is unrelated to the passphrase, or lack of passphrase.

To understand the why of the above, I will use textbook RSA for simplicity. (Real-world RSA is similar to, but not exactly the same as, textbook RSA, as there are many real-world attacks that textbook RSA doesn't deal with.) Here, among some other numbers, the private key is the pair of prime numbers commonly referred to as p and q, and the public key is their product, n=pq, where n is referred to as the public modulus. Given p and q, calculating n is borderline trivial (you just need to multiply two -- very large -- numbers together), but given only n, determining the corresponding values for p and q is extremely difficult. We have no proof that this is so, though; only the absence of any publicly known easy way to actually do it, even with lots of very smart people having worked at the problem for a long time. It's like figuring out that 15 = 3 * 5, except that instead of numbers of a few digits, the numbers involved are many hundreds of digits. To a first order approximation, with your 4096-bit RSA key, n is about 1300 decimal digits long, and p and q are a little more than 600 decimal digits long each. We can see this because log10(24096) ≈ 1233, and 10615 * 10615 = 101230.

  If they can derive the public key, what algorithms can they use to do this? - I don't know.

Semiprime number factorization algorithms. The current state of the art for numbers larger than 10100 (100 decimal digits, about 332 bits) is the General Number Field Sieve (GNFS) algorithm.

A quantum computer could use Shor's algorithm to efficiently factor a semiprime, but (at least in public) we don't yet know how to build a large enough quantum computer that actually works. That's part of what the push toward so-called post-quantum cryptography is about. Last I heard, state of the art was having factored the number 15, but that was a few years ago; it is possible that publicly known quantum computers are now able to factor numbers larger than 15.

  What is the number (or order) of operations needed for each algorithm to derive the Private key?

The complexity of factoring a number using the GNFS is discussed on its Wikipedia page. It's really difficult to discuss the number of operations directly, but after some discussion on prerequisites, the Wikipedia article summarizes by stating that the running time of the number field sieve is super-polynomial but sub-exponential in the size of the input. You can compare the various factoring times and algorithms used for the various RSA numbers, which were part of a competition started in the early 1990s to expand the knowledge relating to integer factorization, now inactive.

Compare also How is it possible that people observing an HTTPS connection being established wouldn't know how to decrypt it? Note that HTTPS works differently from SSH, but the basic operating principle remains similar.


Is there a way to send a password over JSONP (GET) over HTTPS (SSL)? Crypto maybe? I understand sending passwords in the clear over GET is not considered secure because the query string can be logged by multiple eavesdroppers.

However if I REALLY need to use JSONP to submit a username and password to my server, is there a way to do it?

Maybe some crypto on the back-end and front-end?

I was just trying to have a simple approach to get my users to login to two domains (not sub-domains) at the same time, without breaking CORS rules. Basically, what I get in my logs now is this

GET /login/jsonp?callback=jQuery21403191181201609543_1535388742134&email=email%40gmail.com&password=SjRrNOHzN&_=1535388742135 200 32.987 ms - 130.

I believe such query is not secure.

JSONP is usually used with a server sending data to a client, wrapped in a function call which gets executed on the client by javascript.  Sending data to a server does not require JSONP, it just requires a normal HTTP request.

You should definitely not use the GET method for submitting username + password pairs. Secondly your response from the server should not include the login credentials themselves; the sensitive login data should only go one direction (from the client to the server) and never be reflected back. What I would suggest is two asynchronous calls, one to each server. You probably want to do this in parallel, rather than one after the other, using Promises. Then if both promises resolve and both servers indicate successful login, send back session id's or tokens in the response from each server.


Which keystore type is good for java / Tomcat based applications The application is based on Java and Tomcat server. Which type of keystore is better ? does JKS or PCKS12 ?  I understand JDK keytool by default creates JSK type then for which uses-cases one should go for PKCS12 type ?

I tried creating PKCS12 keystore  but unable to generate CSR using keytool -certq. The command fails with an error - Invalid keystore format.

My understanding is that you need to use a Java KeyStore (JKS) object for in-memory handling of certs and keys anyway. The fact that keytool does not know what to do with a P12 is evidence of this. The question is about how you store it on disk.

Both JKS and P12 files use strong encryption. P12 is needed if you want to share keys and certs between a java-based application (ie Tomcat) and a C or C++ application (maybe using openssl under the hood). If your stack is entirely java, then there's no reason to have each process disassemble the JKS into P12 files, and then have each process re-assemble P12s back into a JKS.

Think of P12 as the "Export to PDF" of the certificate world.


Wordlists on Kali Linux? I notice that in /usr/share/wordlists in Kali Linux (former Backtrack) there are some lists. Are they used to bruteforce something? Is there specific list for specific kind of attacks?

Kali linux is a distribution designed for penetration testing and computer forensics, both which involve password cracking. So you are right in thinking that word lists are involved in password cracking, however it's not brute force.

Brute force attacks try every combination of characters in order to find a password, while word lists are used in dictionary based attacks. Many people base their password on dictionary words, and word lists are used to supply the material for dictionary attacks. The reason you want to use dictionary attacks is that they are much faster than brute force attacks. If you have many passwords and you only want to crack one or two then this method can yield quick results, especially if the password hashes are from places where strong passwords are not enforced.

Typical tools for password cracking (John the Ripper, ophtcrack, hashcat, etc) can do several types of attacks including:

Standard brute force: all combinations are tried until something matches. You tpyically use a character set common on the keyboards of the language used to type the passwords, or you can used a reduced set like alphanumneric plus a few symbols. the size of the character set makes a big difference in how long it takes to brute force a password. Password length also makes a big difference. This can take a very long time depending on many factors
Standard dictionary: straight dictionary words are used. It's mostly used to find really poor passwords, like password, password123, system, welcome, 123456, etc.
Dictionary attack with rules: in this type dictionary words are used as the basis for cracks, rules are used to modify these, for instance capitalizing the first letter, adding a number to the end, or replacing letters with numbers or symbols

Rules attacks are likely the best bang for the buck if all you have are standard computing resources, although if you have GPUs available brute-force attacks can be made viable as long as the passwords aren't too long. It depends on the password length, hashing/salting used, and how much computing power you have at your disposal.


How to compile java_atomicreferencearray (CVE-2012-0507) exploit to run calc.exe on system? I got interested in Java exploits and stumbled upon this:

https://github.com/redcreen/exploits/tree/master/CVE-2012-0507/redcreen

It is source code for Java exploit, so even though my knowledge of Java is limited (learned some in highschool) so I tried to understand what is going on in the background.

File https://github.com/redcreen/exploits/blob/master/CVE-2012-0507/redcreen/Exploit.java has this code:

public static void doExploit() throws Exception {
        Help _tmp = getHelp();
        File file = new File("d:/temp/1.php");
        String cmd = "php " + file.getAbsolutePath();
        System.out.println(Help.doWork(_tmp, cmd));
    }

which I presume is the code to be executed with this exploit, so I modified it to:

public static void doExploit() throws Exception {
        Help _tmp = getHelp();
        String cmd = "cmd /c start calc.exe";
        System.out.println(Help.doWork(_tmp, cmd));
    }

To start calc.exe on successful explotation , and compiled it with:

javac -d bin redcreen/*.java
cd bin
jar cvf ../appplet2.jar redcreen/*.class

and placed it in applet:

<!DOCTYPE html>
<html>
  <head>
    <title>Exploit</title>
  </head>
  <body>
    <applet archive="applet2.jar" code="redcreen.Exploit.class" width=1 height=1></applet>
  </body>
</html>

But no luck with calc.exe execution on vulnerable Java machine. Metasploit execution does work. Any guidance or suggestion is welcome.

My java probably isn't any better than yours, but as I understand the vulnerability, it relies on breaking out of the sandbox to execute code.

I believe that when you replaced the php code with your simple command, you broke the part of the process to get outside the sandbox.

Here is a fairly detailed examination of your problem:
 https://media.blackhat.com/bh-us-12/Briefings/Oh/BH_US_12_Oh_Recent_Java_Exploitation_Trends_and_Malware_WP.pdf

Head to page 7 for a detailed explanation of how the exploit works, and the author steps through the code and its execution.


What is the benefit of combining a form with php processing script in a single page using isset I would like to know the benefits of using a single page with both the PHP processing script and the HTML form using isset() as opposed to simply using form action with method POST on one page to call a separate page for processing the submitted form contents.

It seems isset() can cause problems with null values.

Can someone clarify the benefits particularly if there are any security benefits or issues between calling a PHP processing page from an HTML form page and using a single page with PHP processing, HTML form and isset() to determine whether the form is displayed or the contents processed?

There are no benefits or drawbacks security-wise.

Technically it's always two calls to the server, one to load the form and one to process it, no matter how many files you have. So it's just the way to organize your files, nothing more.

No, isset() cannot cause problems with null values, as a regular HTML form cannot send values of any type other than string - so there would be not a single null value to deal with.

What is very important to understand: anything could be faked.

the form could be read or could be not
The handler could be called by a browser from the form page, or could be called by a bot with the form fields completely forged. There is no way to tell one call from another.
the form could be read, but the data could be tampered with, fields removed or renamed or edited
some fiend types (notably checkboxes) are not sent from the form if not selected

So you should treat your handler script as a self-sufficient application that doesn't trust anything sent from the client side. And, among other things, you should always check whether the form has been set, no matter if it's a single script or two separate ones.

Besides, there is no use for isset() if you have the form and the processing code on a single page as opposed to having two pages. isset() is just irrelevant to that. Once you need it, you need it for both implementations.


Can an executable be scanned for calls to the vulnerable glibc ghost functions? The ghost vulnerability has the potential to be vulnerable to many many pieces of software that call the gethostbyname() and gethostbyname2() functions.  Is there an easy way to scan an executable to determine if it makes use of either of these two vulnerable functions?  While this wouldn't tell you if a program was vulnerable, it can tell you if it's NOT vulnerable.

To use either of these functions, I believe the executable (or 3rd party library) must link to it.  It seems to me you should be able to scan the executable for a link to the shared library.

To find out if this calls are used, you could simply do a

strings -a /bin/ip | grep gethost

Another approach returning more information is

readelf --dyn-syms /bin/ip | grep gethost


Can ASN based firewalls be bypassed So we have a firewall that allow only Akamai and Cloudflare servers based on ASN, I was wondering if an attacker can spoof ASN or bypass the firewall and how can it be done ?

IP packets do not contain a ASN value. So what this firewall does, is actually lookup which IP ranges are linked to a specific ASN, and then build firewall rules based on these IP ranges.

If this can be spoofed all depends on which resources the firewall uses to lookup the IP ranges. You didn't mention the brand (and I'm not familiair with any firewall doing ASN based filtering), but the answer to your question really depends on the way it's implemented. Some public registries are less strict in which data can be entered than others, so if one of these less strict ones is used by the firewall it may be possible to make the firewall think a specific IP range is associated with a specific ASN.

Another thing to keep in mind is that sometimes IP ranges get transferred from one ASN to another, especially since there's a shortage of IPv4 addresses nowadays. If old database entries which link the IP and ASN are not removed after a transfer, your firewall could be allowing IP addresses which are not linked to the ASN you allowed anymore.


Does CSP block javascript in  tags? I recently discovered that its possible to run javascript from an <a> tag like this

<a href="javascript:alert('test')">

and this gets run on the current page when clicked. It also seems to run in the context of the page it was clicked on and has access to the websites local storage. I want to prevent this from happening. I can see CSP can be used to block inline javascript blocks but I can't see if this includes these javascript links.

Would adding a CSP header prevent these JS links from working?

Your question can be answered with a simple test using some local HTML file:

<meta http-equiv="Content-Security-Policy" content="script-src 'self'">
click me

When trying to click on the link no Javascript gets executed. Looking at the console in Chrome's developer tools one can see:

  Refused to run the JavaScript URL because it violates the following Content Security Policy directive: "script-src 'self'". Either the 'unsafe-inline' keyword, a hash ('sha256-...'), or a nonce ('nonce-...') is required to enable inline execution.

When adding unsafe-inline as suggested it instead works as expected, i.e. the script gets executed:

<meta http-equiv="Content-Security-Policy" content="script-src 'self' 'unsafe-inline'">
click me

Also, from the documentation of CSP:

  'unsafe-inline'
  Allows the use of inline resources, such as inline  elements, javascript: URLs, inline event handlers, and inline  elements. You must include the single quotes


What is this user trying to do? I work with a company that creates marketing software, we recently created a forum so we could talk with users who need support.

I'm the main admin on this forum and a user, let's call them person1 has been trying to run PHP code in the comments. I originally thought maybe he  was referring to the question with it, but then their comments all started getting marked as spam and needed review. After a handful of comments, I decided to IP Ban them.

Fast forward a month or so, and now someone has been filling out all the forms on our site, in the name slot they used the same username person1, but now they are trying to append html code into the inputs. Each form submission gets sent to email and it showed that he was able to execute an image tag and an a tag in the field. The images weren't malicious or anything, just cat pics, but the links were things like http://www.phishing-site.com and http://www.evil.com. And they also tried running a few SQL statements in the hopes of Dropping our DB.

I ended up looking up their username online and there are multiple accounts by the same name sitting in queue for bug bounties from companies like Paypal, Apple and Windows. Is it possible that they are just running a script to search for bugs in our system, or are they trying to do something more malicious? What could be a possible solution for this?

Assuming this user is legitimately trying to participate in a bug bounty, they should not be attempting drop a database via SQL injection.  This user sounds like a very inexperienced penetration tester, and I get the feeling that he or she may not fully understand the impact of some of the scripts that he/she is running.  The best course of action may be to reach out to the user, and let them know that some of their activities may not be in scope.  I would reference the terms and conditions of the bug bounty as a part of that communication.

If this is a malicious actor, you may want to consider reaching out to them with the same type of message.  They sound very inexperienced, and letting them know they are being watched may scare them off.  Beyond that it's a matter of monitoring your logs, blocking his or her IP, and making sure your software is secure. You could also consider contacting law enforcement. Keep your logs in case he/she does find and exploit a vulnerability.