ACL managed with roles I have resources in an application. Further I have a table holding all resources and for every resource what role is allowed to access it.
I also have defined a Table holding all uses that are registered to my system and the roles they are allowed to play.

My question now: Is this an ACL managed with roles (that could be also called groups)?
Or is this a flat (core) Role Based Access Control?
I do not really see the difference between these two.

Thanks.

Does it matter?

It is both or it is the one that make sense. Probably one makes sense in one context and the other in another.

My background is in Enterprise Directories so I would talk about RBAC and I think that this is more understandable to the business. But ACL's are more understandable to infrastructure techies.

So who is your audience?

Also, where are you going with the application? What is it's future. Will it get more capabilities? It is easier I think to talk about RBAC as you create more layers such as location based control.


Is the Origin header really useful for securing a WebSocket? I've been reading some posts about WebSockets security, and a few of them mention to use the Origin header for helping secure the connection. For example this one https://www.christian-schneider.net/CrossSiteWebSocketHijacking.html.

However, I'm really doubtful about the benefits it's going to provide. Why would I need to use the Origin header? Or better said, how would I use the Origin header for something useful?

Checking the Origin header prevents a WebSocket from being used by another website that the user is also visiting (e.g. to extract data).

As per the link:

  WebSockets are not restrained by the same-origin policy

This is because the protocol upgrade request will have access to the user's cookies, so if you're not checking the origin the request could have been made from example.com and not your site example.net.

e.g. if you have a WebSocket service that returns some private data, you do not want a malicious site that the user has open from reading data from yours because the user is logged in.

It has nothing to do with stopping another website from leeching content from your website - if they wanted to do this they would simply set up a connection to your socket web service from their back-end, where they can set whatever Origin header they want. Checking the Origin header will stop this for authenticated content because they cannot get their back-end to supply the user's authentication cookie to your web service.

They could of course register a user and then send in the authentication cookie for that using their back-end HTTP client. However, the only data they would be accessing is their own, not the end-user's. You may want to detect if certain usernames or remote IPs are pulling lots of your public content down in order to prevent use of functionality in your service that may not be user specific.


Buffer Overflow due to wrong data type I am reading the OWASP page on buffer overflow. It mentions:

buffer overflow can be prevented using higher-level programming languages that are strongly typed and

developer should validate input to prevent unexpected data from being processed, such as of the wrong data type

Can someone give an example when an incorrect data type can lead to a buffer overflow ?

Here are some C/C++ examples:

Reading a long into an int memory space (say with scanf).

int i;
scanf("%ld", &i);

Using a float as an index in a for loop instead of a fixed point structure, resulting in possibly one more or less iteration than expected.

char *arr = new char[9];
for(float j=1; j>0; j=j-0.1) { // will clobber 10 characters, not 9
    *arr++ = 'A';

copying between arrays with different type widths

float floatArr[10] = { 5, 5, 5, 5, 5, 5, 5, 5, 5, 5 };
char charArr[10];
memcpy(charArr, floatArr, sizeof(float));


Nessus scanner and Red Hat backport security updates I have asked this question:
False positive Apache version in scanner results on Centos
I need additional clarification:
Do you know if it is possible to configure Nessus to adopt Red Hat backport security updates?
I want to prevent false positive reports from Nessus.
Example of false positive report:

Apache 2.2 < 2.2.16 Multiple Vulnerabilities

Tried to find the answer here without success:
http://www.tenable.com/plugins/67093
http://www.tenable.com/taxonomy/term/612

You would need to check the locally installed package version:

https://access.redhat.com/security/updates/backporting

As Red Hat back ports patches, so the Apache version sent by the web server will always appear to be "old" (since it is not incremented unless the entire package is rebased to a newer version, which is rare in Red Hat Enterprise Linux). You can cut down on false positives by setting the ServerTokens to "Prod" for example.

In general simply banner scanning (Apache HTTPD, SendMail, Postfix, etc.) will almost always result in a lot of false positives. It is much better to check the RPM's actually installed for example using the yum security plugin:

yum install yum-plugin-security

then make sure all available security updates are installed:

yum updateinfo list security all

for more information please see https://access.redhat.com/solutions/10021


How does john the ripper crack hashes using wordlists? How does John The Ripper work when trying to crack passphrase of a private ssh key? As in what steps are involved when it tries to do so? What's the role of ssh2john in the whole process?

ssh2john is a utility to convert the key-file into a txt-format that would be suitable for JtR to crack by comparing hashes. There are also other utilities available  e.g. password protected zip-files, keepass DBs etc.
The steps really depends on which mode you use to crack, you could use e.g. word-lists or increment mode. see https://www.openwall.com/john/doc/MODES.shtml


Is an AWS "Access Key ID" a secret? AWS's "Secret Key" is (obviously) a secret, but should an "Access Key" alone (without the corresponding secret key) be considered a secret too?

The Access Key ID is used for identifying the access key in logs, configuration, etc. It could in some environments be considered sensitive data if you're looking to not release who accesses which systems and when, but it is not secret.


How IDS works for SSL packets? I am new to IDS. My understanding so far has been that IDS sits behind proxy servers and check the content of the packets for any malicious payloads. How IDS will work on SSL packets? Does it have the private key to decrypt it?

IDS can also work on IP source, destination and other factors, so those will still work on SSL.

If you have provided your IDS with private keys so it can decrypt, or in fact if your SSL endpoint is at the proxy then you can do content inspection as well.


Why can we still crack snapchat photos in 12 lines of Ruby? Just came across this bit of ruby that can be used to decrypt Snapchat photos taken out of the cache on a phone, apparently adapted from here. To my surprise, it worked without a problem, considering the problems around Snapchat's security which have been well publicized lately (Mostly the stuff around the whole phone number/username leak as far as I recall).

require 'openssl'

ARGV.each do|a, index|
    data = File.open(a, 'r:ASCII-8BIT').read
    c = OpenSSL::Cipher.new('AES-128-ECB')
    c.decrypt
    c.key = 'M02cnQ51Ji97vwT4'
    o = ''.force_encoding('ASCII-8BIT')
    data.bytes.each_slice(16) { |s| o += c.update(s.map(&:chr).join) }
    o += c.final
    File.open('decyphered_' + a , 'w') { |f| f.write(o) }
end

So, my question is, what exactly are they doing wrong here, and what could they be doing better in order to improve the security of their application in this regard rather than what they're doing now, considering that people often send intimate things that were never meant to be shared for longer than 10 seconds only to one person, and also considering the popularity of this app?

tldr/for all those who don't really care to know how computers work but still want to know what is up: Basically, let's say you have 40 million people who use Snapchat, with 16.5 million users sending each other pictures, and each picture in its own tiny locked safe every day. Now, what if you gave those 16.5 million people all the same flimsy, plastic key to open each and every one of these lockboxes to capture the Snapchat media?

This is a serious problem in password-management. The first problem here is the way they managed his key in their source code. SnapChat states that they send the photos encrypted over internet, and it is true after all, but they are using a "pre-shared" key to encrypt this data (badly using also AES in ECB mode) so, every user around the planet has the key to decipher each photo.

The problem here is, how did internet get the key? Piece of cake, they just included it in every app, and somebody just searched for it.

  What is this magic encryption key used by any and all Snapchat app?

  M02cnQ51Ji97vwT4

  You can find this (in the Android app) in a constant string located
  in com.snapchat.android.util.AESEncrypt; no digging required, it is
  quite literally sitting around waiting to be found by anyone.

  On a more positive note (perhaps), in the 3.0.4 (18/08/2013) build
  of the Android app, there is - oddly enough - a second key!

  1234567891123456

It is a very bad practice to hardcode a password in your source (no matter if it is in your headers or in your binaries), the main problem being anyone could find it with a simple "strings" command into your binary (or by looking in someplace you used to share your code with your friends):

strings binaryFile

Then the malicious user can have a look to each string and check if that is the password he is looking for. So, if your really need to hardcode a password in your code you better hide it, but this will just be "security through obscurity" and the malicious user will end up finding the key (so you better think in a different approach).

What can they do to improve their security? Well they could have generated a key for each photo, or they can pre-share a key between the clients that are going to share a picture, public/private keys; there are plenty of options.


Relationship between CVSS and Risk Level in Nessus output data In a Nessus output file, does the Risk Level (e.g. Critical, High, Medium, Low, None) depend on the CVSS score? What relationship, if any, do the Risk Level and CVSS have?

Thank yo

generally Nessus severity ratings will line up to the brackets outlined here for CVSS Score --> severity mappping so

  NVD Vulnerability Severity Ratings
  NVD provides severity rankings of "Low," "Medium," and "High" in addition to the numeric CVSS scores
  but these qualitative rankings are simply mapped from the numeric CVSS base scores:

  Vulnerabilities are labeled "Low" severity if they have a CVSS base score of 0.0-3.9.
  Vulnerabilities will be labeled "Medium" severity if they have a base CVSS score of 4.0-6.9.
  Vulnerabilities will be labeled "High" severity if they have a CVSS base score of 7.0-10.0.

However on top of that Nessus has a "critical" rating which according to this blog post they use for CVSS 10 vulnerabilities


Intercepting with Burp does not work - alternative ways When doing bug bounty, there are some sites, which prohibit for good reasons to intercept the requests and responses (with SSL) to the site with Burp and other proxies. So I have the problem to get the content of the requests / responses especially AJAX things. My question is this: Are there any alternative tools to Burp / proxy software to get this information?

What I up to now found, was HTTP Live Header plugin for Chrome / Firefox, but they only show header.

Depending on your actual needs -

Most browser development tools let you see requests / responses including content. Open it (For chrome Ctrl+Shift+I) before loading the page.
There are several browser add-ons for modifying requests in flight. Tamper Chrome for example.
Why doesn't Burp work? Have you added Burps CA cert?


Is it safe to use different derived keys but from the same passphrase for AES CBC encryption followed by HMAC SHA256 hashing? I am working on a cross platform (JS/iOS/Android) list manager application that persists data through a REST API and I want to ensure that any textual data is properly encrypted on the client side so that there's no way to decrypt the data on server side and in the unfortunate case that the database be stolen it does not worth spending any effort on trying to decrypt it.

Many months of research and trial and error has led me to decide that AES encryption in CBC mode of operation is the best choice for the purpose due to its strength and wide adoption on all platforms. I decided to do key derivation based on OpenSSL's similar algorithm so that I have a reliable command-line tool for testing against the accuracy of my implementation.

The only thing that's left is to somehow ensure the validity of the user-supplied encryption passphrase which will never make it to the server side directly. The best idea that has occurred to me so far is to decrypt several list items after login to test if they can be decrypted properly by applying HMAC hashing on the ciphertext, which in turn requires the storage of the HMAC hash on the server side.

I have a couple of questions:

is there any other way to securely ensure the validity of the passphrase provided after a successful login?
is it safe to re-use the same passphrase in AES CBC encryption as a secret key in HMAC hashing of the same encrypted data?

I've seen this TLS thread but I do not need the encryption between a typical client/server setup. In my case the client encrypts the data, stores in the cloud and next time either the same client or another client will decrypt it. Thus, handshakes and such in TLS make not much sense to me.

Note 1: I intentionally call it a "passphrase" above to emphasize it is different from the user password which is validated at log in and is stored as a hash within the user account.

Note 2: On the top of all that, requests will travel through HTTPS. The point of the above is not to ensure transport security but that to restrict data readability to the client side for numerous security benefits.

I appreciate any feedback. Thanks!

You are rolling your own cryptography.  Don't roll your own crypto.  Instead, I recommend that you use PGP or GPG, or use their format: namely, the OpenPGP file format.

You should not use the same key for both encryption and authentication.  I don't recommend using the same key for both AES-CBC and for HMAC.

Instead, I suggest that you derive two keys from the master key.  e.g., Kenc = AES(MK, 0), Kauth = AES(MK, 1), where MK is the master key (an AES key), and 0,1 are two different AES plaintexts.  Now use Kenc as your encryption key for use with AES-CBC, and use Kauth as your authentication key for use with SHA1-HMAC or AES-CMAC.

Alternatively, you can use an authenticated encryption mode, such as EAX, CCM, GCM, or OCB.  Authenticated encryption takes care of deriving keys from a single master key, and takes care of providing both authentication and encryption.

It sounds like you are also making another mistake: using a passphrase as your encryption key.  You should try to avoid using passwords as encryption keys.

Is there any chance you can just use GPG conventional encryption?  GPG has been carefully written and vetted to take care of all these issues.


sample .apk file fore testing the Directory traversal vulnerability I am looking to get a .apk file for testing the Directory traversal vulnerability.

https://github.com/rubyzip/rubyzip/issues/315

We have upgraded the rubyzip gem to address this issue. And I want find sample .apk file for testing the fix.

The example in the book, Hacking Android, covers the Adobe Reader 10.3.1 APK (Adobe_Reader_10.3.1.apk) using the free open-source attack tool, MWR Labs Drozer. The book section title is Path traversal in content providers, part of Chapter 8 on Client-Side Attacks - Dynamic Analysis Techniques.

dz> run scanner.provider.traversal -a com.adobe.reader
Scanning com.adobe.reader...
Vulnerable Providers:
content://com.adobe.reader.fileprovider

MWR Labs Drozer includes a purposely-vulnerable APK called Sieve. If you want to write code to exploit Sieve, check out the -- https://github.com/tanprathan/sievePWN -- project, which includes source code to build your own APK2APK attacks, including the targeting of Directory (aka Path) Traversal. If you search for "apk path-traversal" you are bound to find dozens, if not hundreds, more.


SQL injection using letters and numbers? I was wondering if it is at all possible for a hacker to perform an SQL injection attack using just letters and numbers. For example, let's take a look at this PHP code which uses regular expressions instead of the builtin PHP functions:

<?php
$id = preg_replace('/[^a-zA-Z0-9]/', '', $_GET['id']);
$result = $mysqli->query("SELECT * users WHERE id = '".$id."'");

In case your wondering what the code does, it removes all characters that are not letters or numbers and executes that query it in MySQL. I was wondering if a hacker could be able to exploit that code in some way and if not, what might the difference be between that and mysqli::prepare or mysqli::escape_string?

There would be only a security flaw if it would be possible to leave the MySQL string literal context the $id value is inserted into and to supply arbitrary SQL fragments. And this is only possible if $id contains the plain ' that would denote the ending delimiter of the MySQL string literal:

// resulting SQL statement with $id = "' OR '1'='1"
SELECT * users WHERE id = '' OR '1'='1'

Now since you’re removing any ' character from $id, it is not possible to leave the string literal context and thus it’s not possible to supply arbitrary SQL fragments.

However, this conclusion applies only for the case the value is used in a MySQL string literal. If you’re using the same input filtering on values in a different query, you still may be vulnerable to SQL injections.

This said, methods like mysqli::prepare and mysqli::escape_string are proper mitigation techniques. mysqli::prepare implements so called parameterized statement/query via prepared statements where the command (SQL statement) and the user supplied data are separated from each other so that the user supplied data cannot be mistakenly interpreted as command. mysqli::escape_string would be similar to you current technique as it just escapes certain characters of data to not being confused as control characters like the string literal ending delimiter.


Can a Vulnerability Management tool highlight BIOS and driver-level vulnerabilities? Several known vulnerabilities affect BIOS (Reference URLs below). So my question is, are the Vulnerability Management tools (such as Nessus, NeXpose, Qualys, etc) technically capable of highlighting BIOS and driver-level vulnerabilities? Is this something that can be detected for example via an authenticated Windows scan?

http://web.nvd.nist.gov/view/vuln/detail?vulnId=CVE-2013-3582
http://www.darkreading.com/vulnerability/bios-bummer-new-malware-can-bypass-bios/240155473
http://searchcloudsecurity.techtarget.com/definition/BIOS-rootkit-attack

Nessus does not have a plugin for that CVE. You can check this using the Nessus plugin search. I don't know about the other tools.

In theory it is possible to detect these issues on an authenticated scan, as you can do a WMI query for the BIOS version. It may turn out that there are particular difficulties that prevent this; perhaps the BIOS version doesn't update when you apply the new firmware. Or it may just be that Tenable haven't yet developed such a plugin.

Nessus does have checks for some driver vulnerabilities (e.g. Nvidia flaw) They are generally local checks only, although a few remote ones exist (Etherleak is one that springs to mind).


Why SSL uses a third party (certificate authority) yet SSH does not SSL operations require the use of a trusted third party -- the certificate authority to verify a public key presented by a server to a client.

SSH on the other hand relies on the client having the server's public key by some other means (e.g., by accessing it physically from the server and saving it at the client).

Why do these protocols have such a difference in operation mechanisms? I mean they could both use the third party approach which to me seems more user-friendly and possibly more secure.

Because they're used differently. TLS/SSL x509 certificates as commonly used in HTTPS is used to connect to public systems, i.e. systems that are accessed by a large number of people, most of whom had no prior out-of-band connection with the owner of the system.

SSH, on the other hand, are primarily used to access private systems by a small number of server administrators who have had prior access to the system to setup the server keys or other forms of out-of-band access to the system to verify the server key fingerprint.

Note that the SSH model is insecure if you do not verify that the key fingerprint presented by the server matches what you expect before connecting. In TLS, the responsibility of checking the ownership of the key fingerprint is offloaded to certificate authorities (CA).

TLS can also be used with self signed certificate or with private CA, which works in similar trust model as SSH.


Security implication of telling the user they can't login because of too many attempts from IP On Code Review stack exchange, in response to code that informs the user when their login attempt failed because of too many login attempts from an IP, I was told

  "Absolutely do not message end user telling them why login failed.
  You are giving a potential attacker critical information to aid them
  in attacking you application. Here you give an attacker very precise
  information to get around your IP restriction."

https://codereview.stackexchange.com/a/164608/93616

Am I practicing bad security? Should I explain in more vague terms like "Too many login attempts" or "You could not be logged in"?

Update: In case there's any ambiguity, currently the too many attempts logic and message does not care if the attempts were successful or not.

Absolutely do not message end user telling them why login failed. You are giving a potential attacker critical information to aid them in attacking you application.

On the other hand, not telling a user why their login failed is a potential usability disaster.

If you don't clarify whether the user's IP was banned or the user instead used a wrong password, they might panic since it seems to them that someone accessed their account and changed the password to lock them out. If my login with a pre-filled password fails, the first thing I'm thinking of is a break-in rather than an IP block.

Also, a naive IP blocking mechanism might be ineffective and introduce additional problems. It is potentially trivial to bypass for an attacker with sufficient resources and someone who shares an IP address with other users might abuse the IP ban to lock out others. Instead, a CAPTCHA after n failed attempts per IP might be a softer solution and more appropriate for your application.

Also see:

Is it good practice to ban an IP address if too many login attempts are made from it?
Why do people use IP address bans when IP addresses often change?


Why most people use 256 bit encryption instead of 128 bit? Isn't 128 bit security enough for most practical applications?

Why do people buy red sport cars ? They do not go faster than sport cars of any other colour...

AES comes with three standard key sizes (128, 192 and 256 bits). Many people see this and think that if there are three distinct sizes instead of just one, then there must be some difference, and since the 256-bit version is a bit slower than the 128-bit version (by about 40%), it must be "more secure". So they go for "the most secure" and choose 256-bit keys.

In reality, the AES has three distinct key sizes because it has been chosen as a US federal algorithm apt at being used in various areas under the control of the US federal government, and that includes US Army. US Army has a long-standing Tradition of using cryptography, and that Tradition crystallized into internal regulation with all the flexibility and subtlety that armies around the world constantly demonstrate (just listen to some "military music" and you'll understand what I mean). Unfortunately, this happend quite some time ago, before the invention of the computer, and at that time most encryption systems could be broken, and the more robust were also very hard and slow to use. So the fine military brains came up with the idea that there should be three "security levels", so that the most important secrets were encrypted with the heavy methods that they deserved, but the data of lower tactical value could be encrypted with more practical, if weaker, algorithms.

These regulations thus called for three distinct levels. Their designers just assumed that the lower level were necessarily weak in some way, but weakness was not mandatory. So the NIST decided to formally follow the regulations (ask for three key sizes) but to also do the smart thing (the lowest level had to be unbreakable with foreseeable technology). 128 bits are quite sufficient for security (see this answer for details). Therefore AES accepts 256-bit keys because of bureaucratic lassitude: it was easier to demand something slightly nonsensical (a key size overkill) than to amend military regulations.

Most people don't know or don't care about History, and they just go for big because they feel they deserve it.


Self-signed SSL certificate on chromebook (and android) I am having the following problem on both my android phone and on my chromebook. I'm running a website on an internal server (10.3.3.3) using nginx with a self-signed ssl certificate. Since it is just an internal server, I put the CN=10.3.3.3. All of our desktop machines work just fine (they give a warning about the certificate, but after we tell the browser to connect anyways, it works just fine). This is true of all browsers I've tried on the desktop machines (chrome, firefox, safari).

The problem is on my android phone and chromebook. On both of these, when I type in the ip address, I get the typical chrome yellow screen saying there is something wrong with the certificate. When I click "proceed anyways", it looks like it is trying to load, but the site never comes up. What do I need to do to get chrome on these mobile devices to work?

P.S. I did import the certificate into Chrome on the chromebook and it shows up under "Authorities".

As an interesting test, I downloaded a ChromiumOS virtual machine and it works just fine (gives cert error, but when I click proceed, everything works fine). I should have noted that the chromebook and the android phone are coming in over VPN, but everything else on the VPN works fine (ssh to the web server, etc).

The Certificate

Certificate:
    Data:
        Version: 3 (0x2)
        Serial Number: 9485437517293169565 (0x83a30b2a7d6c2b9d)
    Signature Algorithm: sha1WithRSAEncryption
        Issuer: C=XX, ST=XX, L=XXXX, O=XXXXXX
        Validity
            Not Before: Apr  2 12:41:40 2014 GMT
            Not After : Apr  1 12:41:40 2016 GMT
        Subject: C=XX, ST=XX, L=XXXX, O=XXXXXX
        Subject Public Key Info:
            Public Key Algorithm: rsaEncryption
                Public-Key: (2048 bit)
                Modulus:
                    XXXXXXXXXX
                Exponent: XXXXX
        X509v3 extensions:
            X509v3 Basic Constraints:
                CA:TRUE
            X509v3 Key Usage:
                Digital Signature, Non Repudiation, Key Encipherment, Certificate Sign
            X509v3 Subject Alternative Name:
                IP Address:10.3.3.3
    Signature Algorithm: sha1WithRSAEncryption

the common name cannot be an IP address. You may put IP addresses into the subject alternative name section, but as IP address not DNS
the certificate might need a CA=true property if you want to import it as authority, simply self-signing might not be enough. You might still be able to import it and it will show up, but does not work.
it failed for me for Firefox and Chrome until I've put also extended key usage of "TLS Web Server Authentication" in the certificate and also Netscape Cert Type 'server', which seems to be missing from your certificate. After I've added both it also works with Chrome on Android.

This is the certificate which works for me:

Certificate:
    Data:
        Version: 3 (0x2)
        Serial Number: 1893982163 (0x70e3dfd3)
    Signature Algorithm: sha256WithRSAEncryption
        Issuer: CN=foo.com
        Validity
            Not Before: Apr  7 18:47:17 2014 GMT
            Not After : Apr  7 18:47:17 2015 GMT
        Subject: CN=foo.com
        Subject Public Key Info:
            Public Key Algorithm: rsaEncryption
                Public-Key: (2048 bit)
                Modulus: ...
                 Exponent: 65537 (0x10001)
        X509v3 extensions:
            X509v3 Subject Key Identifier:
                32:04:C3:BF:60:46:D4:4A:90:2F:CC:55:F1:B1:7D:B7:BF:7A:61:4B
            X509v3 Authority Key Identifier:                    keyid:32:04:C3:BF:60:46:D4:4A:90:2F:CC:55:F1:B1:7D:B7:BF:7A:61:4B

            X509v3 Authority Key Identifier:
                DirName:
                serial:70:E3:DF:D3

            X509v3 Subject Alternative Name:
                IP Address:192.168.178.4
            X509v3 Basic Constraints: critical
                CA:TRUE
            X509v3 Key Usage: critical
                Digital Signature, Certificate Sign
            X509v3 Extended Key Usage:
                TLS Web Server Authentication
            Netscape Cert Type:
                SSL Server
    Signature Algorithm: sha256WithRSAEncryption
        ....


Can we always remove WWW from a host name? When I'm opening https://india.gov.in, it's opening all right. But for https://www.india.gov.in, the browser is throwing a certificate error. Why is that happening?

www is a common prefix for websites.  However, at a technical level it is just another subdomain, and there's nothing special about it. If a webserver accepts both or even more DNS names, it has to be configured that way. The server decides which configuration to use based on the DNS name in the HTTP request.

The certificate served for https://india.gov.in covers india.gov.in.  It does not cover www.india.gov.in, nor does it cover any other subdomain (foo.india.gov.in) or other domain (example.com).  This is the most basic form of TLS certificate, and a pretty common one.

The DNS records for india.gov.in and www.india.gov.in don't necessarily have to go to the same place; they could resolve different IP addresses and dfferenet DNS record types.  This is commonly done for hosting various applications on a single base domain, e.g. having mail.india.gov.in go to a webmail server.

A common way for companies to deal with this sort of issue is to buy a wildcard certificate (*.india.gov.in) to cover all their subdomains.  OWASP recommends against this because you have to secure every endpoint that needs the certificate (in our example above, an attacker breaching the webmail could extract the certificate and use it to man-in-the-middle a connection to the normal website, or vice versa).  A better option is to use a SAN certificate that includes just india.gov.in and www.india.gov.in, then set up redirects for any page requested on one domain to the other.


Purpose of key confirmation Among the requirements for a secure key exchange is the key confirmation. I wonder why is this step required. Even if the other party hasn't computed a correct value for the shared secret, it doesn't matter. It won't be able to decipher the information sent anyway. Why bother and make sure that the other party actually possesses the correct shared secret? It is said that this is a requirement for a secure key exchange. But why?

They certainly could decipher anything you send because you are talking about synchronous encryption, where the same key is used to encrypt and decrypt the traffic. In order for this to work both sides have to agree on a key for exchange. Shared secret verification is not actually a requirement for a secure key exchange from a theoretical standpoint, you could exchange keys securely with anyone really. However, if you do not verify the other side then you could be setting up a VPN with anyone, even those you do not want to, and send all sorts of confidential information. This is why sender verification is an integral part of all secure transfer technologies.

You may be getting confused by mixing up PKI and VPN technology, mistakenly thinking that when verification is taken care of by PKI that only the true recipient can decrypt the traffic. It's not that simple because PKI decryption (asynchronous as opposed to synchronous encryption) is extremely computation intensive, so secure transfers almost always use PKI for sender verification but then set up synchronous encryption for the transfers themselves.

EDIT: poster says the source is a lecture

If both sides do not share the same key neither side would be able to decrypt the other's traffic, so key confirmation is important from an operability perspective if not from a pure security perspective. Also, if you are using a VPN to check for authentication (see IPSEC AH) then you must verify keys, or you can't be sure what is authentic traffic.  What the lecturer may mean is that it simply won't work without a key verification, rather than being a security process.


Security implications of using a OAuth-enabled password manager I've resisted the idea of password managers for a long time. Bringing together passwords for all your online accounts in one place that is only protected by difficult-to-remember master password doesn't sound like a good idea to me.

However, I've been doing lots of password resets lately. I try to vary my passwords as is recommended but I always forget them. Doing a password reset takes unnecessary time and it is a pain in the butt. So then I thought... why not try a password manager that uses Google's OAuth service instead of a master password? People who gain access to my Gmail account would be able to log into all these accounts anyway, since they can do a password reset.

Of course there are still other risks associated with such a setup. Malware could steal the database and brute force it. Then again typed passwords could be stolen by a keylogger and session cookies could be intercepted as well. A cloud-based password storage solution may introduce even more additional risks. But on the plus side, if I don't have to remember the password I can use much tougher password strings.

What are your thoughts on this idea? Would it be less safe to store my passwords this way in exchange for increased convenience? Are there existing software products out there that authenticate with OAuth instead of a master password? You may want to consider that I already have two-factor authentication turned on for my Google account. I would only use this tool for services that already send password reset e-mails to this Google account.

It certainly is more convenient. But i doubt it would be more secure.

For one thing, such a setup introduces another point of failure compared to the master password solution. The attack surface would be larger as there would be another target (Google), to compromise instead of just your password manager service. How much more risk this adds depends on how you view Google's security.

Is remembering just ONE highly random password that difficult for you? My online passwords are stored with lastpass. All of them have very random passwords ranging from 18 to 30 characters. I only have to remember ONE 10 character password(which i deem secure enough to withstand bruteforce attacks).

You still have to remember the password of your gmail account, which SHOULD be just as long and random as any password you would consider for your master password. So i don't see any benefits to your scheme at all.


Is penetration testing becoming objectively "harder" as apps/protocols/operating systems become more secure? I am currently enrolled in Offensive Security's "Penetration Testing with Kali" course, which is aimed at newcomers to penetration testing.  The course is great, with many examples/exercises, and a great virtual lab environment which allows me to connect via VPN and practice everything we've been learning.

One thing which I have noticed is that many of the vulnerabities we've been studying/practicing have been on older e.g. Windows XP/2003 systems, older Linux versions, or have been relying on misconfigured systems (which, if configured correctly, would be much more secure) or protocols which are known to have serious flaws in them.

I'm well aware that newer versions of these systems have vulnerabilities of their own.  I am also guessing that many of the older systems still persist in usage within organizations anyway.  However the weight of the study material which is placed on older systems makes me wonder if in the future, penetration testing will necessarily either become less useful or need to shift in its methods as developers become more security conscious in authoring their protocols/apps/OSs, and as their tools become more advanced. E.g., many higher-level languages manage memory for developers, making buffer-overflows much less likely, even for careless developers.  Also, it is my perception (though I could very much be wrong, I'm no expert) that modern operating systems are significantly more secure than their predecessors.

I know that ANY system will have SOME flaws somewhere, however it seems that penetration testing as a professional level involves by definition some degree of standardized scanning/exploitation of known vulnerabilities.  My question then is, is the surface area which professional penetration testers shrinking, as security-awareness increases among developers of apps/protocols/OSs, and as the built-in security of their tools improve?

I'm not implying that I think penetration testing would ever "go away", but e.g. it might start to rely more on social engineering than actualy technical vulnerabilities in the networks or software.

The objective of penetration testing is not to find vulnerabilities, and so it hasn't failed if it doesn't find any. It's to check whether or not vulnerabilities are present. It doesn't get harder if systems get more secure, it just comes up with fewer vulnerabilities. In fact, it will get easier if the list of known vulnerabilities to check gets smaller.


Why is generating Certificate Signing Request (CSR) supposed to be platform/machine specific? I've seen questions Is it true that certificates requested with a specific CSR can only be used on the machine where the CSR was generated? and CSR generation origin? and Generate CSR code on local machine ; I've also seen https://serverfault.com/questions/471289/must-csrs-be-generated-on-the-server-that-will-host-the-ssl-certificate  - but these answers don't explain why majority of instructions for generating CSRs insist that the generation is performed on the specific platform/machine (e.g., look at https://knowledge.rapidssl.com/support/ssl-certificate-support/index?page=content&id=SO6506 or https://nz.godaddy.com/help/windows-generate-csr-for-code-or-driver-signing-certificate-7282 , and many others).
If this were, as I assume, only for convenience sake (i.e., to use specific instructions/tolls available on a platform), it'd be understandable - but, e.g.,  the godaddy instructions (one of the links above) explicitly says, for a signing certificate, "It's important that you generate the CSR from your local machine and not from the web server you're using to host the file" - why would that matter?
As far as I understand, all that matters is the possession of the private key.  So - are these platform/box-specific instruction just for convenience sake and to ensure the security of the private key is not compromised while moving it between machines?

Generating CSR is not platform specific, it's true as you say, that you only need the primary key and private key isn't tied to a specific machine.

However, especially in a beginner's tutorial, there are a couple of reasons why this advice can be sensible:

It limits the private key to just the machine that will use it. You won't have copies of the key lying around in machines that shouldn't have them, which can become another avenue of key leaks.
It increases the likelihood that you'll be generating the key in the right format for the software that's going to use them. If you have openssl on the server, the key generation tool from openssl will generate pem files instead of pkcs12. While it's not too difficult to convert between formats, this reduces friction for less knowledgeable users.

Telling people to generate keys at the place it's going to be used achieve these goals while being fairly simple for less knowledgeable customers to follow and produce good security for them.


Solutions for accessing webapp from inside and outside the corporate perimeter by same users? I'm looking for solutions that could best address the following requirements.

We plan to develop a webapp and deploy it in the cloud.
Corporate users must be able to access the webapp from the enterprise network, where they're already connected to a corporate Active Directory, with an SSO mechanism (e.g. SAML, OAuth/OpenID Connect, WS-Fed, etc.). This is the "easy" part, as ADFS provides solutions for this.
Here is where it gets less obvious: The same users can be on the road, and still be able to connect to the same webapp.
When they're on the road, though, SSO is not mandatory: they could connect with other login credentials (e.g. via the webapp's own userid/password management system, or through a third-party identity provider). If there are solutions where they still could use their AD credentials from the outside of the company, this should be of course considered.
In any case, a user should get her/his same preferences, personal data, etc. in the webapp, independently of the way s/he logs in (i.e. from inside the company or when on the road)
If a user is de-provisioned from the AD, s/he must not be able to connect using the webapp's own login system or third-party identity provider. Same thing if her/his group memberships change: it must be taken into account in the webapp, whatever the login option used.

I understand there are many possible solutions (VPN connection, using Azure AD, etc.), but what would be the one(s) with the best combination of impacts on the present infrastructure, cost, user-friendliness, security, and availability?

Thanks!

Sounds like a job for Azure AD Connect, then your app can authenticate against Azure AD regardless of where the user is (interal/external to the company's lan).  As long as they can reach your app they'd be able to log in with their credentials.

https://docs.microsoft.com/en-us/azure/active-directory/connect/active-directory-aadconnect


How does this Bitcoin scam work? Lately I have been receiving messages from accounts on Discord telling me that I have won 1 BTC in a giveaway. This is obviously not true, but I have a hard time seeing how these accounts will get anything useful out of me falling for this.
The instructions in the message for getting the 1 BTC goes like this (with a lot of emojis springled in):

You WON: 1 BTC!
How to receive your BTC?
Register account in: maticbit.com
Go to the "Codes" section and activate your code
Withdraw BTC to your address.
Done!

I could guess that by registering an account I would have to enter some personal information which they could use, but I am not going to visit the site of course.
You can't withdraw BTC from a wallet just by knowing it's address, so it's not like they are after bitcoins, it seems like it's something else they are after.

I dug into this, cause I also got the Discord message. Felt too good to be true, right? Well, yes, it is too good to be true.

I set up a new Browser, with no history in it, made a temporary email and signed up. I entered their "You have won" code, and sure thing, they did deposit 0.48 BTC on the account I just made on their site. Cool.

(They probably just edited a value in a database somewhere though, so I doubt there is any real BTC under that value)

Alright, so lets withdraw that to a newly made wallet, right? Nope!

So this is how the scam works: Make you sign up -> give you "free BTC" -> request a really small deposit (to prove you are not a bot) -> take that small deposit and laugh all the way to the bank. (Just like @Demento predicted)

Until I have significant proof from multiple credible sources, I would not trust this.


For intrusion detection, tripwire, using crypto hash integrity checking - what can be expected? Intrusion detection using something like Tripwire that conducts integrity checks through crypto'ed hash functions of files requires a scan and to hash the file and save this for later comparison.  This process takes time so what files can we expect to be effectively protected from this and what files change too frequently to be safeguarded?

Typically default installations of host based IDS products like Tripwire, will come with a database/list of files protected.  This will usually focus on things like configuration files and system binaries which change infrequently and not on things like application log files which do change frequently.

If you need precise data for that product I'd recommend looking at the vendors web site as they'll have more exact data for each OS that they work with.


Using PDF instead of doc(x) or html: safer? Similar to the recent question about why we lock our computer, many people send documents as PDF file instead of a doc or html page because it would protect editing the document. And yes, it does add some value because you're making it less easy to do, but it's still easily doable. There are thousands of resources describing how you can edit a PDF, and even official documentation on the PDF format.

So why does everyone, including tech people, think PDF is a much better format to use?

Edit: Thanks for the answers. The weird thing is that people always bring "you can't edit it" as first argument, even at school, and I'm doing application development so it's not like the people there are computer illiterate.

Layout preservation is no issue in my case because we know the teachers use Office 2007 or 2010 on Windows 7, just like us. Still, most people hand documents in as PDFs, and then (when asking) arguing it's so that they can't tamper with what you handed in...

The reason PDFs are preferred isn't security so much as a combination of technical capability and user expectation.  The security of PDF and Word read only modes is about the same (which is to say, not very good, but good enough to prevent casual use.)  Both files require a viewer on the other side, and there is both a Word and PDF viewer app for free, while the tools to make both generally cost money, though some services will do either for free.

User expectation however is generally that a Word document is something they edit.  They feel like they are being blocked from doing something when they work with one that is protected and this can lead to a negative user experience.

The other factor is that Word is not a format that gives much control over the way the document flows.  You can make an OK layout in Word, but a variety of factors can end up impacting how it is rendered.  This is a simple side effect of the fact that Word is a word processor, designed for typing, not layout.  PDF on the other hand was designed specifically as a print production and document reproduction format.  It's sole purpose in life is to ensure a consistent viewing experience and printing experience regardless of the hardware it is displayed on or printed with.  This is the primary reason why people, especially document generation professionals prefer PDF as a distribution format.


How secure is HTTP / HTTPS over 3G? Suppose I log into a website, such as Twitter, from a 3G-enabled smartphone or similar device. How secure is this from interception? Can someone steal my password or login?

What if I use HTTPS? What if my device can only get a 2G signal or similar? Does it differ by country?

For HTTP, you rely on nobody being able to spy on your packets (or alter/drop/duplicate them) between your device (your smartphone or computer) and the target server. 2G and 3G offer some encryption, but only from your device to the nearest base station; encryption is "over the air". From the base station to the target server, there is no encryption (or, at least, nothing is standard-enforced), so you cannot assume that the data is protected. Besides, the 2G encryption is based on A5/1, which is known to be weak (and there are ways to force a given cell phone to switch back to A5/2, which is weak by design, and can be cracked in real-time). 3G uses KASUMI which, while academically weakened, is still beyond cracking with today's technology. However, I repeat, 2G/3G encryption is only against nearby adversaries, who limit themselves to the radio link between your device and the station. Don't use HTTP for transfers of valuable data.

HTTPS is HTTP-within-SSL. SSL has been designed to offer security (server authentication, confidentiality and data integrity) regardless of the transport medium. 2G/3G is irrelevant to the security of HTTPS. It depends on your browser / operating system (and, in particular, which certification authorities are accepted as "trusted roots"), not on the network.


Modular security for a photography UAV? Is modular security possible?

In the context of an embedded device, is it possible to create an add-in module that will be responsible for both communications and security, with his role being creating a single secure link to access to a cloud server while limiting all other access.

The idea is that the main system won't have another another communication path, and using this module, whatever you do in the main module, your system will be secure (assuming the add-in module is secure).
So that basically, the main system programmers couldn't introduce security vulnerabilities however hard they try.

I assume that system update is also handled by the add-in module.

To make it more concrete, the system I'm thinking about is a photography UAV. The threat model is either remote attacks or physical attack to a single UAV which can give control over a fleet of similar UAV's.

Can a modular security architecture with a security module separate from the main module work in this scenario?

When you have the main module only communicate with the radio module through the security module, the security module could do all communication with the base server signed and encrypted without the main module even noticing it.

But the communication between base server and UAV is not the only attack vector one could think about.

UAVs are often equipped with different kinds of sensors. When you have a vulnerability in interpreting that sensor data in the main module, that would be exploitable (example: trigger an integer overflow when interpreting the brightness level of a photo sensor by pointing a laser at it). And you can forget about also filtering the sensor data through the security module, because the security module can't know what kind of sensor input will trigger a bug in the main module.

The same attack vector applies when there is any malicious data which originates from the base server itself. When the base server isn't trustworthy, the security module won't be able to do anything about it because it doesn't know what malicious activity to look for. This attack vector could also manifest when the base server receives information from some outside source and relays it to the UAV unfiltered.

Also, it would not protect against physical access. An attacker with physical access would be able to place a third chip between main module and encryption module to MITM the unencrypted communication between these two chips (assuming we are talking about two modules which are physically separated and not just logically separated features of the same chip)


Is this a secure Digital Signature + Encryption method? I am trying to wrap my head around Digital Signatures and how RSA Encryption supports them. And which order to do them along with what specifically to encrypt.

So say we have Alice and Bob and a Secret message M

Alice has: Bob's Public Key(B_pk), Alice's secret key (A_sk), Alice's Public Key (A_pk)

Bob Has: Bob's Public Key(B_pk), Bobs's secret key (B_sk), Alice's Public Key (A_pk)

Alice generates a SHA256 hash of the message M. SHA256(M)
Encrypt the resulting hash with Alice's secret key using RSA. C1 = RSA(A_sk,SHA256(M))
Then Encrypt M with Bob's public key. C2 = RSA(B_pk,M)
Send C1 to Bob
Send C2 to bob
Bob gets C1, Decrypts with Alice's public key resulting in SHA256(M)_received
Bob gets C2, Decrypts with his secret key, resulting in M_received
Bob then runs SHA256(M_received) and checks if SHA256(M_received) == SHA256(M)_received

Are there any flaws in this method?
Is Confidentiality, Integrity, and Authenticity protected?

Update:
I am curious as to what the weaknesses are in the above method.

The order is important. Encrypt the message to the receiver then sign the message. Receiver can verify signature and then decrypt.

The other way (sign then encrypt) means that Bob (receiver) can send someone else Alice's (sender) the signed message without her knowledge or agreement as if it came from someone else (decrypts with his key, re encrypts with 3rd key).

By doing encrypt and sign, it's clear that Alice meant the message for Bob.

The idea is that no one else can sign the encrypted message and no one else can decrypt the signed message.

Also, if Bob needs to show what Alice signed (the message is a contract), the encryption algorithm should be symmetric like AES and Bob reveals the key. It's the symmetric key that Alice encrypts with Bob's public key. So, there are two encryptions: symmetric, asymmetric and a signature.


IDS for Personal Computer (Mac) I'm reading the Nmap Security Scanning book and it mentions that servers often have Intrusion Detection Systems installed. From my understanding, these systems alert server admins when there is suspicious activity.

I'm interested in installing an IDS for my personal computer, a Macbook. I'm not too concerned with any security threats. I just want to see what this type of software does.

How useful is having an IDS on a personal computer? Are there better options available?

I don't think a server-intended HIDS system (like OSSEC) is a good option for a laptop or other general purpose computer.  Servers in today's age are very specialized and regimented and a HIDS depends on this.  It knows where files should and should not be created or modified, what processes should and shouldn't be running.  Essentially, there is a white list of allowable things that happen on the computer and anything outside that list is an alert.

The term for personal computer protection is 'endpoint protection' and includes things like traditional anti-virus.  They use blacklisting, primarily - known signatures, known bad behaviours.  It is a much harder problem on an endpoint, since users want to run arbitrary programs and do arbitrary things - how do you tell the difference between an installer the user wants to run and one that is accidentally run from an attachment in email?  Between a compiler and a self-modifying virus?  Lots of issues there.

Running HIDS on a personal computer is just going to be annoying - give it a try on one of the many low-cost/cheap linux hosts out there.


Is there a more secure way for users to log into the domain other than just passwords? Say you have this:

An NPS server that grants access to users using client certificates (EAP-TLS).

So for example someone managed to snatch the domain administrator's password and they log in to the computer using the domain administrator's username and password. Then using their regular user certificate, the NPS server grants them access to the network and, based on their certificate, places them in a regular Users VLAN. That Users VLAN would be able to access the domain controller, otherwise no domain users could log in.

So now that this person has access to the network, they can log in to the domain controller as an administrator even though they don't have the administrator's certificate. All they needed was to know the administrator's password. So certificates here are essentially useless.

Why isn't there a way to log in to a domain controller other than just using a plain password? (I know there's smart cards, but they are too complicated and expensive to set up). Like why can't you make the domain controller log users in using their certificates?

The EAP-TLS authentication mechanism deployment as described only proves that an authorised user is operating the device. This could be a certificate in the local user's profile, the computer's profile, or linked to a TPM. In the end though, once that authentication is done, the network can only assume all subsequent network traffic is authorised.

The attack you mention is conceptually the same as a person accessing an unlocked workstation to connect to a resource using stolen credentials. As far as the session is concerned, the authorised user is performing the action.

If you're talking about network (file sharing/remote administration) then locking that down with extended authentication mechanisms is very difficult. Blocking local console (RDP) access is as simple as firewalling that port to hosts that are strongly authenticated and network segregated.

The root of your troubles is the domain admin account's password. Good practice is to grant permissions only as required, and membership of Domain Admins is then restricted so that administrators are not members of that group in the normal course of work.

Should a function need to be performed with those privileges, a well-controlled process for granting those permissions temporarily will have more benefits than trying to augment Windows' authentication mechanisms.


Can my web accesses be known by individuals? Someone, I think it was on Charlie Rose, said that anybody who wants to can currently discover what websites have been visited by some person of interest. That assertion was possibly made as a way of saying that one should not worry about the government doing what private citizens are already doing. It used to be that my Internet access was via a university account. As part of its normal daily operations, the university posted a list of all outgoing connections by user name. So if somebody had wanted to know whether I was accessing some juicy site they could just access the university's website, navigate to their log, and search for my name. As far as I can determine, the university in question is no longer posting this information. However, in the past that is one way of stalking individuals that could have been used. Perhaps there are still ways to access such information.

Was the security specialist's assertion true when he claimed that any Internet user's web accesses can be learned by private individuals? (I'm just trying to get an educated view on the hubbub over recent disclosures. Might as well be educated before shooting off my big mouth.)

A private individual would have trouble, but many private companies know what you do online.  Your ISP certainly knows.  Marketing companies that have deals with large numbers of websites can track you from one site to another if they have agreements with those sites.  Websites themselves can also tell what IP address you connected from.  If you use single signons like using your Facebook account on multiple sites, then Facebook can tell a decent amount about where you go.  There are also hints about where you have gone left on your computer unless you clear your cache, temp files, cookies and history, though someone would have to have access to your system to make use of it.

If the security "expert" was claiming that any person can tell what any other person is doing on the Internet, they were extremely mistaken however and are not an expert at all.


Newline XSS vulnerability So I was experimenting with XSS using new line (%0A) character.
So I got to the usual vector: '%0Aalert(/xss/)//
and one thing came to my mind. What if you can't insert a quote?

A new line will break the string so you can insert code. However, the syntax error (Unterminated string) will prevent the script from executing.
Is there any way around it?

Thank you!

You could end your script element and start a new one:

%0A</script><script>alert(/xss/)//

There will still be a syntax error in the original script (none of it up to this point will run), but the added one will still execute (including anything that comes after it). Demo. As you can see, disallowing quotes is not a valid defense against XSS, escaping is the way to go.

(And in case you're wondering, the attack is possible even if the call were wrapped in a function or eval.)


VeraCrypt: create encrypted container: Volume Format: Options: Filesystem: None? I see VeraCrypt has an option to create an encrypted container with no filesystem. How is this possible? If there is not filesystem there, then how can I place my files or folders in the container? Is this an option for those wanting to place a single file in the container? Thanks.

How it is possible

You simply get presented a virtual volume (or virtual drive with a loop/raw/non-existing partition table depending on how you look at it) that has nothing on it. Indeed you can't directly put any folder on it but you might want to format it in another file system not offered from inside Veracrypt (e.g. exFAT, ext2 on Windows, UDF?). In fact you can think of the formatting as an extra service that has nothing to do with the encryption itself. AFAIK, Verycrypt itself does not care at all about the file system when you decrypt the container then. It simply just presents the volumne to the OS which then deals with it.

What for

Like mentioned before you might want to format it some other way, maybe in some other format or with special settings. Or you have some complicated setup where you actually don't need any direct file system because you want to dedicate that volume to a database server or to be used as a raw disk for some virtual machine (which in turn lets you put a partition table and several partitions on it). Heh, now that think of it even some sort of software RAID solution should be possible.


How can I secure a REST service intended to be used by my customers' customers via their public website? I am developing a service with an associated REST API for customers (companies which have their own websites) to use.  In other words, one of my customers would typically make the REST call directly from their website (i.e. the request would originate from one of their customer's browsers).

I can of course provide an access token to give my customer access, but by definition it will have to be published publicly on their site, which means that anyone would have access to it.

The situation seems analogous to the use of Google Maps API keys, for example.  Unless I'm mistaken, if I embed a map on my page, my API key needs to be public.  As far as I know, the only protections against other people using my key are that I can restrict requests (with Google) to certain domains.

Is this the only thing I can do to restrict access to my customers?  Is it possible for a non-customer to spoof their referring domain?  If so, do people do this to use other Google API keys?

The Referer field is easily spoofable, as it's a client-side variable. Don't rely on it for anything serious, like access control.

To control the domains allowed to use your API, you must ask them to proxy every access to your service, and use authentication on your side. This way when their customers access their site, the request will pass through their servers, a script there add the authentication details, and send to your server.

The client will never see the credentials, and you can ban or throttle the keys you suspect are misusing the service.


Meterpreter reverse shell alternative What can you do if you are behind NAT but can't do port forwarding and don't want to pay for a virtual server with internet-facing IP? I read the answer to this question  which suggests some tunneling software (e.g. ionide, pwnat) but those have to be installed on the target machine too and you can't use them with Meterpreter. That question is four years old so are there better alternatives now?

I think Meterpreter Bind Shells are what you want. They typically bind and listen on a specific port on the remote target, so no port forwarding is needed on your side. However, the target must have the ports Meterpreter uses open to the Internet, not only Local Area Network. Read more about Bind Shells here.


What is the actual security of this login page? Please visit https://devforums.apple.com

If I visit this site using my Safari 6 web browser, this page does not show the normal security indicator that secure sites normally show.

Does this necessarily mean that this login page is insecure?

However, https://itunesconnect.apple.com shows as being secure, according to Safari 6.

So the question is: How can I know whether a particular https site is secure, when it doesn't show the normal security mark?

Certain elements of the page are not sent via HTTPS. This means that those elements can be read by anyone sniffing the network, or modified in-transit by an active attacker. This might result in an attacker executing JavaScript on the page. As such, your browser is warning you that the page is, for most intents and purposes, the equivalent of not being encrypted at all.


Does nmap help to know if firewall is turned on? Is it possible to know firewall status using nmap? How?

How to test firewall rules

One of the most important aims of these scans will be to verify and test that your firewall filters and rules are performing as intended. To do this, you need to run a scan to look for ports that appear open to the outside world; then check whether they are filtered or not. A simple Nmap firewall audit scan would be something similar to:

nmap –v –sA –n www.yourorg.com –oA firewallaudit

The Nmap TCP ACK scan (-sA) will establish whether packets can pass through your firewall unfiltered. To speed up the scan, the –n option can be used to prevent reverse DNS resolution on the active IP addresses it finds. I would also use the –oA output option so you create a searchable file as well as an XML file to use for record keeping and reporting. You can use these output files to review the traffic flow through any unfiltered ports and then modify your firewall rule sets where necessary.

One mistake many administrators make when allowing traffic through their firewall is trusting traffic based simply on its source port number, such as DNS replies from port 53 or FTP from port 20. To test firewall rules, however, you can use most of Nmap's TCP scans, including the SYN scan, with the spoof source port number option (--source-port or abbreviated just to –g). By providing the port number, the network mapper will send packets from that port where possible. The following example will run an FIN scan, which will use a spoofed source port number of 25 (SMTP) and save the output to file firewallreport.txt. Now you can see if a particular port is allowing all traffic through:

nmap –sF –g 25 –oN firewallreport.txt www.yourorg.com

Another worthwhile check is to test a firewall's ability to cope with fragmented traffic. Malicious hackers often split up the TCP header over several packets to make it more difficult for packet filters and intrusion detection systems to detect an attack. While fragmented packets won't get past packet filters and firewalls that queue all IP fragments, many devices have queuing functions disabled by default to avoid a drop in performance. Simply adding the -f option will set a scan that uses fragmented IP packets.

When auditing your firewall, option –r will scan ports in numerical order, making it easier to follow the traffic flow when examining the Nmap output files. However, when you're testing the effectiveness of firewalls and IDSes, I would use a randomized port order, which is the default option. You can also randomize the order in which hosts are scanned by setting the --randomize-hosts option (–rH.) The randomization, combined with slow timing options, which we'll look at in a moment, will make any network monitoring devices work hard to detect the scan. Here's an example that could possibly test your network defences:

nmap –sS --scan-delay 500 –f –rH firewallreport.txt www.yourorg.com

Once you have identified any unfiltered ports or other issues, you should review and update your firewall rules to ensure access to all services is controlled and filters and rules are performing as anticipated. If you do make changes to your firewall, rerun the audit scan to ensure your changes have achieved the desired effect. It's also a good idea to run this type of audit scan on a regular basis to ensure your firewall configuration has not been modified unexpectedly.

Nmap includes a variety of timing options that allow you to modify almost every scan aspect. The "scan-delay" option (above) causes Nmap to wait the specified time between each test it sends to a given host.

The default setting keeps a scan going no matter how long it may take to complete, but this can be overridden with the Host Timeout option --host_timeout. The option sets the amount of time a scan will wait before aborting a scan, giving up on the host, and moving on to another IP address. This setting can be useful when scanning network devices over a slow connection.

Reference: How to manage firewall testing using Nmap


application runtime separation - best practise I need to persuade "the management" that running two or more unrelated business-critital applications within a single shared runtime environment (i.e. a single "command line") is a really bad idea. Problem is the management doesn't recognise "the security-freak guy authority" (me) and wants my cause to be backed by some recommendation from an actual autority such as ISO, ISACA, NIST or any other three-to-four-letter-agency.

Is there a defined "best practise" or requirement in any of the security standards that would clearly state that running two or more separate and unrelated applications (such as database processes) in a single shared runtime environment with the same UID is wrong?

Please note that I know it's a bad idea and I can come up with many reasons to back this claim but none of these include a quote from "a standard".

Find you who insures your company for costs related to Information Lost, etc. Typically in the contract they define requirements for critical system such as what your describing. Present it to your legal team in the nicest way possible (bring bagels) than watch management scramble to get it resolved and by proxy bring your system up to standard.

Even if it not spelled out specifically by a letter agency, your companies lawyers will see it in this light:

"If we go to court over data lost and the insurance company brings in an expert to testify that our system were not using best practices, we will lose."

In Security, Legal can actually be of big help.


Is there a trusted independent firewall review company? I don't know how to write this without it sounding like a plug (lol), but it's not. So please don't close-vote it, even if you really want your editor badge. Here goes:

There's this site called av-comparatives that I use and trust to provide me independent antivirus reviews. You probably do, too, actually. While I keep myself somewhat knowledgeable about infosec, my specialties lay elsewhere and it's so useful for me to have something like that as a resource.

I don't know of anything like that for firewalls, and when I go out to find one, I'm accosted with millions, all claiming that one product or another is the best. Cross-referencing them often leads to one or two that I've never heard of. The (I think) fairly obvious conclusion there is that these are all just fake third party review sites set up for marketing purposes.

Unfortunately, I don't have the resilience to wade through such murky waters for so many more hours :P

  IMPORTANT: This is NOT an open invitation to fake firewall review sites to post
  their crap. I will respond appropriately to spam.

I'm looking for legit review sites that you, as security professionals, trust (ie: on par with av-comparatives, which you probably trust too)

To your initial question, the only thing I've seen that purports to really do this is the Gartner Magic Quadrant. However, given the overall complexity of firewall solutions, it's hard to make an apples to apples comparison in my opinion. Often they are used for their basic layer 3 and layer 4 filtering capabilities, and as such are treated like commodity devices like a switch. In this case the most important thing is simply finding a reputable vendor that can handle the scale you operate at for the cheapest price you can find.

I am making the assumption you're talking about hardware appliances, but in general this would go for any firewall solution. It's really tough to get a real answer on a firewall, since there are so many variables. There's how much bandwidth it can push, how many connections per second it can handle, the rule chain processing, application level stuff, etc. There often are IDS features bundled into firewalls, but again testing is needed to use these at scale.

Like with any technology, scaling is always a concern. However, unlike AV a firewall generally has a key point in the infrastructure and so if it runs slowly it causes real business impact immediately. There are so many features available in various firewalls, it's also very hard to do an apples to apples comparison. I've done some pretty large scale firewall implementations and testing with aggregate bandwidth in the 100s of Gbps. The way we performed it was testing several vendors using simulated traffic similar to our production traffic. We found that in our case some vendors just could not handle our traffic patterns, despite them being "rated" for our environment.


Server + Client certificate vs Server certificate + Client password There are three different ways how TLS (1.2) can be used:

server and client authenticate
only the server authenticates
neither authenticates

If neither server nor client authenticates using a certificate the connection is not protected against man-in-the-middle (MITM) attacks.

The TLS 1.2 specification says that the connection is safe as soon as the server authenticates. And I wonder:

Does it make any security difference whether the client authenticates or not if the server authenticates?
If both the client and the server need to authenticate, does it matter whether the client sends a trusted certificate in the handshake or just sends a secret (and strong) password as application data?

When only the server sends a certificate, but not the client, the SSL connection is fine and dandy, but the server has no clue about who it is talking too. What SSL provides in that case is that the server can be sure that it talks to the same client all along, with no possible eavesdropper in the middle. If the server must still know who the client may be, another additional authentication must take place, e.g. the client sends a username+password to the server. This is how things go on usual HTTPS Web sites.

Certificate-based client authentication is most useful when the client wants to demonstrate its identity to the server but not give any secret to that server. This really makes sense when the client certificate has been issued to the client by a Certification Authority distinct from the server owner. If the server itself is giving certificates to clients, then using a client certificate does not has much conceptual advantage over a simple show-the-password authentication.

(Client certificates may have some implementation advantages: they can be used with certificate-aware smart cards; and since the certificate thing is done in the SSL handshake, it avoids the need to include a show-the-password authentication protocol within the application data.)


What can be disadvantages (impacts) of keeping passwords in plain text in web browser? While hunting for bugs, I landed on a website which shows my password in plain-text when I inspect element when I sign in (I didn't tweak things like changing type attribute to text).  I can clearly see my password which I just typed without doing anything.

How can I show its impact to the company? How can a attacker abuse this flaw?

The attacker can't abuse this flaw any more than what he can do already without the flaw.

You probably have an impression that websites (and web browsers) which don't allow you to see the actual password in the HTML are protected against an attacker who would get ahold of your computer during filling in the login form. This is not true since:

I can use web inspector tool to sometimes extract the password directly (as you can in your case)
I can use the javascript console to extract the password with DOM access methods
I can use the network monitor in the web inspector tool, submit the form and analyze the request parameters to extract your password

So it can hardly be considered a flaw.


Secure website with unique machine certificate Is it possible to allow access to a website only for specific clients on specific machines?

I'm no security expert, but one idea I had is to generate a certificate that would work only on a specific machine (so if the certificate was stolen, it wouldn't work on other computers) and then somehow use that to authorize myself on the website (plus providing a username and password).

The security requirements are very high, and I would like to avoid developing a desktop application for scalability and maintainability reasons, but security becomes an issue.

Is this achievable on the web, or should this be a purely local application?

I would appreciate any reading material about this issue. Thank you.

Use TLS client authentication, and only trust the specific issuer certificate at the server. You must be able to securely enroll your clients to use this of course,  and the private key of the client must be kept securely. One method is to issue snart cards to the clients.

Client authentication is mostly used for machine to machine communication rather than web-browsers nowadays.


Dnscrypt vs Dnscurve? Which is better for highest privacy and security ? I've read both of them and i still don't understand the differences between them...

Can anyone explain what features is exclusive to one? My most concern is privacy and security.

See http://dnscrypt.org/ and http://dnscurve.org/

With DNSSEC and DNSCurve, one can verify that a DNS response contains what the zone owner configured the authoritative servers to serve. The registrar and the parent zone owner can also produce valid DNSSEC signatures. But no one else can.

In a perfect world, everything would be signed with DNSSEC or DNSCurve, and everybody would run a validating resolver on each device, providing almost end-to-end security.

Unfortunately, this is not the case.

A usual scenario is that the local router has a built-in caching resolver, and all the devices connected to it just use that.

However, the local network is usually the network segment which is the most vulnerable to DNS spoofing. So, it's nice to have DNSSEC/DNSCurve verification on the router, but it doesn't prevent injection of fake DNS responses by someone on the same network as you. This is where DNSCrypt can help.

DNSCrypt is typically deployed using a pair of DNS proxies: a client proxy and a server proxy.
The client side of DNSCrypt is a proxy to which regular DNS clients can connect to. It translates regular DNS queries into authenticated DNS queries, forwards them to a server running the server DNSCrypt proxy, verifies the responses, and forwards them to the client if they appear to be genuine.
The server side of DNSCrypt receives DNS queries sent by the client proxy, forwards them to a trusted DNS resolver, and signs the responses it receives before forwarding them to the client proxy.

The DNSCrypt server can run on the router, along with a modern DNS resolver. Clients can then run the client code of DNSCrypt, leveraging the router DNS resolver.

    |----- Most vulnerable to attacks ------|            |-- Most vulnerable to censorship --|

         dnscrypt client               dnscrypt server
Laptop/workstation/phone/tablet --------> home router --------> ISP --------> the Internet

    |--------- Secured by DNSCrypt ---------| |------------- Secured by DNSSEC --------------|

Alternatively, companies, organizations and individuals are running public DNS resolvers supporting the DNSCrypt protocol. These can be used as an alternative to running a DNSCrypt server and a DNS resolver on the router. If your ISP is doing DNS-based censorship, this is a way to bypass it (but in that case keep in mind that the 3rd-party DNS resolver you use can still log all your queries).

All you need to use them is a DNSCrypt client such as dnscrypt-proxy or Pcap_DNSProxy. This will make sure that responses you received are the same as what the 3rd party DNS resolver you are using initially sent. However, these responses might not be the correct ones. It's just what these services decided to send to you, not necessarily what the owner of the zone you are querying published.

Some VPN services run their own DNS resolvers, accessible over DNSCrypt, in order to mitigate DNS "leaks". Since you already trust them for tunneling all your traffic, it cannot hurt.

The DNSCrypt client can run on every client device:

    |----- Most vulnerable to attacks ------|            |-- Most vulnerable to censorship --|

         dnscrypt client                                                                                dnscrypt server
Laptop/workstation/phone/tablet --------> home router --------> ISP ----------> the Internet --------> public DNS resolver

    |----------------------------------- Secured by DNSCrypt -------------------------------------------|
                                                                              |--- Secured by DNSSEC ---|
                                                                     |--- Most vulnerable to logging ---|

Or if you totally trust the local network, the DNSCrypt client can run on the router instead:

    |----- Most vulnerable to attacks ------|            |-- Most vulnerable to censorship --|

                                        dnscrypt client                                                  dnscrypt server
Laptop/workstation/phone/tablet --------> home router --------> ISP ----------> the Internet -------->  public DNS resolver

                                            |------------------ Secured by DNSCrypt --------------------|
                                                                              |--- Secured by DNSSEC ---|
                                                                     |--- Most vulnerable to logging ---|

Finally, you can run your own DNSCrypt server on a remote, trusted network, to get the best possible protection against censorship, while having full control over what the resolver is logging:

    |----- Most vulnerable to attacks ------|            |-- Most vulnerable to censorship --|

        dnscrypt client                                                                                dnscrypt server
Laptop/workstation/phone/tablet --------> home router --------> ISP ----------> the Internet --------> private DNS resolver

    |----------------------------------- Secured by DNSCrypt -------------------------------------------|
                                                                              |--- Secured by DNSSEC ---|

So, which one do you need?

They are complementary, and address different things.

If you are running your own caching resolvers, having them support DNSSEC and DNSCurve validation is an excellent thing. Unfortunately, as of today, the number of domains signed with DNSCurve is close to zero, and the number of DNSSEC-signed zones is growing pretty slowly.

For all the zones that aren't signed, DNSCrypt cannot protect everything, but it will at least protect the few hops between your client devices and the DNS resolver, which is better than nothing. It also runs on a different port than regular DNS traffic (443 instead of 53), which is enough to bypass some content filters.

But if your primary concern is privacy, what you need is a VPN.


Is it good to split file into chunks to be more secure in the cloud? I have an encrypted file. I want to keep it in the cloud, but it contains my private data. I think it would be be more secure if i split it into four parts and upload each part to a different cloud service (Dropbox, etc.). Is this a good way to store private data in the cloud?

Edit: Which one is better? Encrypt file first then split into chunks or split file to chunks then encrypt each one?

You could split the file into parts, and probably be a little bit safer. But the usability loss v. security gain trade off isn't very good.

With good crypto (such as AES) on the client there isn't really any need for that. Focus instead on keeping your key random and secret, and the system that does the encryption secure. Those are your weak points.


Can you stop a BeagleBone from being imaged? I am working on a group project to have encrypted data on a BeagleBone Black without WiFi (however we will be connecting it to the internet) where you have to type in a password to access it and if you get the password wrong three times it will delete all the data. However you can get around this by imaging the computer and brute forcing the image.

I was wondering if anyone knew how to stop that? Or if they knew another way stop the problem?

If you don't want someone to steal the BeagleBone and bruteforce it, you can encrypt the whole disk and keep the key online.

You could write a custom program to send the password to your server, and have the server send back the key to decrypt the disk. If someone submits the wrong password a couple times, consider the computer stolen and erase the key. This way you can delete the key even before someone tries the wrong password.


Why are buffer overflows executed in the direction they are? I'm following The Security Tube’s video here.

He overviews buffer overflows, and mentions how memory is executed from highest to lowest in the stack (at least with his implementation I assume). So we pass the memory address of a function that's not called in the program, into a 3 word buffer. We overflow that buffer with a 12 character string, and then the memory address backwards. So it looks something like this:

printf "123456789abc\x32\x07\x45\xb4" | ./demo

The actual address was (b4450732).

Why is it that we display the memory address backwards, but at the end of the stack? If memory is read from high to low, shouldn't it be backwards, but at the beginning of the string we pass to the program? Obviously, this is not the case—since he showed it working. However; it seems to me that the stack would not be overflowed and the values \23x\cba987654321 would be executed.

Crash Course in Computer Architecture

In an Intel x86 and x64 architectures there is something called the stack.  This is essentially where everything to determine the execution path is stored.  Parameters to functions, local variables, and return addresses are all stored on the stack.  CPU registers keep track of where in the stack the program is executing.  You can push values and memory addresses onto the stack up to the architecture's bit-size.

What do I mean by that?  If you're on a 32-bit system, then each value you push onto the stack will essentially be an unsigned int 32-bits in size (4 bytes).  If you're on a 64-bit system it will be 64-bits in size (8 bytes).  Below is an example[1] of what the stack looks like for a function:

uint32_t function(int a, int b, int c, int d, int e, int f, int g, int h);

The example above is for x64.  CPU registers RDI, RSI, RDX, RCX, R8 and R9 store the first 6 parameters, and the rest are pushed on the the stack.  The return address, g, and h will be 8-byte values.  g might only equal 0x10, but when you push it on the stack it will look like 0x0000000000000010.

After the parameters are pushed onto the stack the call instruction is executed.  This will push the return address onto the stack, and jump to the function for execution.  Because the stack grows towards low address space each time you push something onto the stack it moves closer to zero.  In the picture above you'll also see the local variables xx, yy, and zz.  Each of these are also moving down the stack towards lower memory.  Of course, realize that the program is always manipulating the top of the stack.

Stack Overflow

Lets say you create a local variable that is a buffer with a maximum of 12 bytes.  Something like this, unsigned char buffer[12];.  The stack makes space for 12 bytes of data.  Lets say we fill this buffer with "012345678912"  it's going to look like this on the stack1:

High
...
32313938
37363534
33323130
...
Low

Because the beginning of the buffer will always be towards lower memory[2].  So when you begin writing into a buffer you're always writing from Low to High.  If you don't allocate enough space and you write more data than you have allocated you have a buffer overflow.

Endianess

Now you want to overwrite the return address on the stack.  You put it at the end of your string so that as the copy writes over higher memory it overwrites your return address with the address you want there instead2.  Intel throws another curve ball at you.   x86 and x64 systems are Little Endian.  Which means that the least significant byte is in the smallest address.

So you'll want the least significant byte of the address (0x32) written to lower memory.  So you'll write the address into memory backwards because you're writing from low to high memory.  When viewing the address from high to low (as the example above shows) the memory address will look correct.  However, when viewing from low to high it will be backwards.  The important aspect to remember is that the architecture requires the LSB to be written to lower memory.

1 - I'm using a 32-bit system here because a 4-byte width is easier to draw out.
2 - Saved EBP, I'm ignoring this because it's not important to the discussion.  It's very important to remember, but just kind of ignore its existence for now.


Maximum number of certificates generated by a CA What is the maximum number of certificates that can be generated from a CA?

The use case is a VPN using certificate authentication and I would like to know what is the theoretical number of unique certificates that I can issue.

RFC 5280 states that "Certificate users MUST be able to
   handle serialNumber values up to 20 octets.  Conforming CAs MUST NOT
   use serialNumber values longer than 20 octets."
Of course one doesn't have to conform...

Edit: an octet is 8 bits  so if you have 20 octets that's 160 bits...for binary we have base 2 bits => 2^160 = 1.4615016e+48  AKA a really really big number...


Google Chrome browser warning for goo.gl I am getting the solid red screen Chrome browser malware warning for Google's own URL shortening website, goo.gl as well as other sites such as bit.ly and delicious.com when I try to navigate there directly via the web (not mobile/tablet device) tonight.

This seems rather unlikely! What might be the cause?

Google's Diagnostic page says:
http://safebrowsing.clients.google.com/safebrowsing/diagnostic?site=http%3A%2F%2Fgoo.gl

  Part of this site was listed for suspicious activity 1 time(s) over the past 90 days.

URL-Shorteners are often used to obfuscate malicious links. Google's own link shortener is no exception.

Maybe the safebrowsing blacklist overreacted and just blacklisted everything below goo.gl


Should I keep incoming data UDP ports open in a minimal server environment? I have a minimal, uncustomized Ubuntu 16.04 xenial Nginx server environment with only these incoming data TCP ports unfiltered:

22, 80, 443, 9000

When reviewing /etc/csf/csf.conf I found out that the following incoming data UPD ports are unfiltered:

20, 21, 53

Should I filter these 3 so no one could try to access my system through them?

DNS uses TCP or UDP port 53. If you filter out [block] this port you
may get problem at resolving the domain to IP address.
Port 20 and 21 are associated with file transfer [FTP]; SSH is
considered a better & secure approach so filtering out this
shouldn't cause a issue.

But please keep in mind your current scenario and network first before filtering out a port or service.

  You can further read about the well known ports at:
  https://en.wikipedia.org/wiki/List_of_TCP_and_UDP_port_numbers


can web application disable browser's password manager's remember feature for that application? Is there anything a website code do to prevent any browser from remembering your password? I am aware that from browser's options, users can change setting to ask to remember password or not. But can website have code that disables this feature so that when you visit the website login page and log in, whatever setting your browser may have is now not gonna ask to remember it? My opinion is that you can not really do that from the website like your websites client side javascript code. I am wondering if there is some sort of standard out there that allows this feature.

So first a little bit of information:

Auto Complete is not filling in the login form, a password manager is. Modern browsers will NEVER have auto complete remember a login form!

Password managers are NOT a security flaw or point of attack. An unprotected/poorly designed system, bad users, and bad policies are.

Most browsers these days implement a password manager into their browser(NOT auto complete) that keeps things in a safe and secure location(for google chrome, it's actually stored in your google account cloud). In google chrome, firefox, and edge you can disable the password manager and it will not affect auto complete. This is because auto complete and password manager are two separate sub programs running in the browser. autocomplete=off on a form does not say "Don't Fill In A Form", it says "Don't Remember This Form". However a browser will still probably fill in a login area and ask to remember it because password managers are not auto complete, and thusly ignore this. If the password manager is turned off and you go to a login page, it will not automatically fill in the form even if auto complete is turned on. This is because of the way most modern browsers implement auto complete and their built in password managers. What does this mean? Well it means you, as a web developer, have NO CONTROL over a users browser program itself, just the web page. As such you cannot prevent the password manager form remembering the password, just the same as you can't prevent the user from writing the password on a sticky note or in the mud.

So what can you do to prevent this? Nothing. That's not a bad thing though. You just need to build your website, applications, and services as secure as possible so that if something gets compromised, as little damage as possible happens to your service.

If a security expert tells you a password manager is a security flaw, ask them how they manage their randomly generated, routinely updated secure login credentials and private keys. Then find a new security expert!!!

That being said, a password manager is not something to be feared. It can actually be a GOD send for storing randomly generated, routinely updated enterprise level passwords.


How does a browser choose which certificate to use if my web server has multiple certificates? I'm using Apache 2.4, with two certificates, one RSA signed by CACert, and one ECC self-signed.  Neither of these certificates provide a path to a broswer-trusted root certificate.  My question is this:  When presented with two different certificates for a website, how does the browser decide which one to use?

Guess
My educated guess from reading the spec: The browser will never see more than one server-certificate. Rather the cipher spec is negotiated in advance. And ONLY THEN does the server send the certificates.

So if negotiation winds up with an an RSA-cert authenticated cipher suite, then the RSA cert chain will be sent. And if the negotiation winds up with an ECDSA-cert authenticated cipher suite, then the ECDSA cert chain will be sent.

Standards document: http://tools.ietf.org/html/rfc5246#section-7.4.2

  7.4.2.  Server Certificate [...]
  The certificate MUST be appropriate for the negotiated cipher suite's key exchange algorithm and any negotiated extensions.

Testing
I can't test for this right now.
And: last I heard (2013) SSL-Labs couldn't either: Qualys Forums: Dual certificates and key exchange scores


is it safe to use archive.is (webpage capture) to open a potential malware domain? When I see potential malware posting in a forum or mail, I am sometimes curious what's the content. In this cases I open the URI with archive.is and then see the ad/SPAM.

Is this procedure safe for a macOS user? Is it possible to get somehow infected?

Is this procedure safe for a macOS user?

No it's not. And archiving malicious stuff online is bad.

  Is it possible to get somehow infected?

Yes.

Best case scenario: The URI point to an ad for generating money on click (Not harmful).
Worst case scenario: The URI point to a well crafted RCE script, that install a RAT. Welcome to the attacker's botnet.