Cross Site Scripting

Cross site scripting (XSS) is a common attack vector that injects malicious code into a vulnerable web application. XSS differs from other web attack vectors (e.g., SQL injections), in that it does not directly target the application itself. Instead, the users of the web application are the ones at risk.

A successful cross site scripting attack can have devastating consequences for an online business’s reputation and its relationship with its clients.

Depending on the severity of the attack, user accounts may be compromised, Trojan horse programs activated and page content modified, misleading users into willingly surrendering their private data. Finally, session cookies could be revealed, enabling a perpetrator to impersonate valid users and abuse their private accounts.

Cross site scripting attacks can be broken down into two types: stored and reflected.

Stored XSS, also known as persistent XSS, is the more damaging of the two. It occurs when a malicious script is injected directly into a vulnerable web application.

Reflected XSS involves the reflecting of a malicious script off of a web application, onto a user’s browser. The script is embedded into a link, and is only activated once that link is clicked on.

SQL Alter Table

SQL ALTER TABLE Statement

The ALTER TABLE statement is used to add, delete, or modify columns in an existing table.

The ALTER TABLE statement is also used to add and drop various constraints on an existing table.


ALTER TABLE - ADD Column

To add a column in a table, use the following syntax:

ALTER TABLE table_name
ADD column_name datatype;

Code Access Security

Code Access Security (CAS), in the Microsoft .NET framework, is Microsoft's solution to prevent untrusted code from performing privileged actions. When the CLR loads an assembly it will obtain evidence for the assembly and use this to identify the code group that the assembly belongs to. A code group contains a permission set (one or more permissions). Code that performs a privileged action will perform a code access demand which will cause the CLR to walk up the call stack and examine the permission set granted to the assembly of each method in the call stack. The code groups and permission sets are determined by the administrator of the machine who defines the security policy.

man in the middle attack type

Prevent SQL Injection

Most instances of SQL injection can be prevented by using parameterized queries (also known as prepared statements) instead of string concatenation within the query.

The following code is vulnerable to SQL injection because the user input is concatenated directly into the query:

String query = "SELECT * FROM products WHERE category = '"+ input + "'";

Statement statement = connection.createStatement();

ResultSet resultSet = statement.executeQuery(query);

This code can be easily rewritten in a way that prevents the user input from interfering with the query structure:

PreparedStatement statement = connection.prepareStatement("SELECT * FROM products WHERE category = ?");

statement.setString(1, input);

ResultSet resultSet = statement.executeQuery();

Parameterized queries can be used for any situation where untrusted input appears as data within the query, including the WHERE clause and values in an INSERT or UPDATE statement. They can't be used to handle untrusted input in other parts of the query, such as table or column names, or the ORDER BY clause. Application functionality that places untrusted data into those parts of the query will need to take a different approach, such as white-listing permitted input values, or using different logic to deliver the required behavior.

For a parameterized query to be effective in preventing SQL injection, the string that is used in the query must always be a hard-coded constant, and must never contain any variable data from any origin. Do not be tempted to decide case-by-case whether an item of data is trusted, and continue using string concatenation within the query for cases that are considered safe. It is all too easy to make mistakes about the possible origin of data, or for changes in other code to violate assumptions about what data is tainted.

retrieving data with SQL Injection

Consider a shopping application that displays products in different categories. When the user clicks on the Gifts category, their browser requests the URL:

https://insecure-website.com/products?category=Gifts

This causes the application to make an SQL query to retrieve details of the relevant products from the database:

SELECT * FROM products WHERE category = 'Gifts' AND released = 1

This SQL query asks the database to return:

  • all details (*)
  • from the products table
  • where the category is Gifts
  • and released is 1.

The restriction released = 1 is being used to hide products that are not released. For unreleased products, presumably released = 0.

The application doesn't implement any defenses against SQL injection attacks, so an attacker can construct an attack like:

https://insecure-website.com/products?category=Gifts'--

This results in the SQL query:

SELECT * FROM products WHERE category = 'Gifts'--' AND released = 1

The key thing here is that the double-dash sequence -- is a comment indicator in SQL, and means that the rest of the query is interpreted as a comment. This effectively removes the remainder of the query, so it no longer includes AND released = 1. This means that all products are displayed, including unreleased products.

Going further, an attacker can cause the application to display all the products in any category, including categories that they don't know about:

https://insecure-website.com/products?category=Gifts'+OR+1=1--

This results in the SQL query:

SELECT * FROM products WHERE category = 'Gifts' OR 1=1--' AND released = 1

The modified query will return all items where either the category is Gifts, or 1 is equal to 1. Since 1=1 is always true, the query will return all items.

la storia di Microsoft

 

logo old

La nascita di Microsoft è indissolubilmente legata alla storia dei due co-fondatori, William Henry “Bill” Gates III e Paul Gardner Allen che già nel 1973, hanno dato vita ad una propria società, la Traff-o-Data, per l’analisi dei dati sul traffico urbano.

I due futuri co-fondatori sono impegnati da tempo, sia singolarmente che congiuntamente, nello sviluppo di programmi, ma l’euforia si scatena all’inizio di dicembre del 1974 quando sulla prestigiosa rivista Popular Electronics fa bella mostra di sé il “primo microcomputer kit”, ovvero l’Altair 8800, realizzato dalla società MITS (Micro Instrumentation and Telemetry Systems). Va precisato che per prassi, Popular Electronics riportava nella testata la data del mese successivo a quello di pubblicazione.

Il sistema proposto da MITS è affascinate ma non dispone di un linguaggio di programmazione evoluto e per “programmarlo” è necessario intervenire fisicamente su appositi switch. Gates e Allen intuiscono di potersi ritagliare un ruolo nel settore a cui Ed Roberts, proprietario di MITS, sta dando un contributo fondamentale. I due amici propongono a Roberts un interprete Basic per l’Altair, ma non hanno a disposizione né un Altair (disponibile ufficialmente dagli inizi del dicembre 1974 ma difficilissimo da reperire) né un interprete Basic, neanche per altre piattaforme.

Ma la sfida non spaventa Gates ed Allen che si buttano a capofitto nell’impresa, assumendo Monte Davidoff per lo sviluppo di alcune routine di base. Il 2 gennaio del 1975 viene siglato l’accordo per poco più di 31.000$ e il 4 aprile, i due soci si trasferiscono ad Albuquerque (New Mexico), vicino alla sede della MITS, per continuare lo sviluppo del BASIC e realizzare un software che consenta di collegare un’unità disco all’Altair. Allen, parallelamente, viene assunto come direttore del software alla stessa MITS.

L’Altair Basic diventa largamente utilizzato dagli Hobbisti, soprattutto quelli dell'Homebrew Computer Club, ben noti a Gates, che, contestando l’alto prezzo d’acquisto (500$ in versione stand-alone e $75 se comprato con un Altair dotato di una interface board e 8K di memoria), non si fanno problemi a copiarlo illecitamente. Il futuro CEO di Microsoft va su tutte le furie e scrive una inattesa lettera aperta agli hobbisti del club, pubblicata sul bollettino ufficiale di febbraio del 1976, in cui non lesina di criticare aspramente la prassi.

Durante quasi tutto il biennio successivo, a legare Gates e Allen c’è un accordo di collaborazione e fiducia, anche se la volontà di fondare una propria società è già nell’aria, come dimostra la lettera del 29 novembre del 1975, scritta da Gates ad Allen, in cui viene utilizzato per la prima volta il termine “Micro-Soft”. Secondo il futuro CEO, il nome “Micro-Soft” rappresenta bene la loro Vision, coniugando due elementi fondamentali: MICROcomputer e SOFTware. La società viene registrata ufficialmente solo un anno dopo, il 26 novembre del 1976, come Microsoft, poco dopo che Allen rassegna le dimissioni dalla MITS.

gates allen primi anni ms

Gates e Allen durante i primi anni in Microsoft

Microsoft ha intenzione di creare nuove versioni del Microsoft Basic da vendere ai produttori storici che si stanno affacciando al business del personal computer, come General Electric, Citibank, NCR e i nuovi arrivati, come Commodore, Apple e Radio Shack che siglano velocemente un accordo di licenza per il linguaggio. In particolare, Microsoft incassa una tantum 21.000 dollari da Apple, per quello che diventerà l’Applesoft BASIC, non fiutando il grande potenziale di vendita dell’Apple II (più di un milione di macchine). Facendo un calcolo semplicissimo è come se la Microsoft avesse venduto ogni copia a 2 centesimi di dollaro!

Cominciano anche le prime campagne pubblicitarie, a partire da “The Legend of Micro-Kid”, e la società prende casa al One Park Central Tower in Albuquerque

legend micro kid

The Legend of Micro-Kid

Nel 1977 arriva il Microsoft FORTRAN, seguito nel 1978 dal Microsoft Cobol, entrami sviluppati per il sistema operativo CP/M che, nel giro di un biennio, diventa il sistema operativo di riferimento per micro/personal computer ( Sirius, Zenith, Sharp, ecc.), trasformando, di conseguenza, Microsoft nella società leader nel settore dei linguaggi per microcomputer. Sempre nel 1977, Ed Roberts è costretto a vendere MITS alla PERTEC per gravi problemi economici, scatenando una battaglia giudiziaria in merito ai diritti di proprietà intellettuale del Basic dell'Altair, rivendicati dalla nuova proprietà. La questione, visto anche la scarsa giurisprudenza relativa, si protrae per diversi mesi, ma alla fine Gates ed Allen la spuntano, sostenendo e dimostrando che il Basic era stato dato solamente in concessione.

Alla fine del 1978, pronta a trasferirsi nella nuova sede a Bellevue (stato di Washington), Microsoft ha 13 dipendenti, due in più della storica foto di gruppo dello stesso anno, un ufficio vendite in Giappone (denominato ASCII MICROSOFT) e circa 1milione di dollari di fatturato.

primi11 dipendenti 1978

I primi 11 dipendenti di Microsoft (1978)

Nel 1979 Microsoft ha un compilatore BASIC praticamente per qualsiasi microcomputer, ma non fatica ad intuire come il business legato al mondo dei personal computer sia ben più ampio. Gates e Allen danno così vita alla Consumer Products Division, pensata per la creazione e commercializzazione per prodotti destinati al settore consumer. Nonostante i titoli realizzati riscuotano un ampio successo, fra tutti Adventure e Olympic Decathlon, Microsoft ha anticipato troppo i tempi ed i numeri sono relativamente bassi, così come i profitti.

microsoft adventure

Microsoft Adventure

Nel frattempo arrivano i primi premi, come l’“ICP Million Dollar Award” che per la prima volta viene dato ad un prodotto per personal computer, e viene annunciato (giugno 1979) il compilatore BASIC per il nuovo i8086 a 16bit.

Il decennio si chiude con l’espansione Europa, stabilendo una nuova sede per la distribuzione in Belgio (per meglio supportare ICL, Phillips, R2E e svariati altri OEM), con un fatturato di oltre 2milioni di dollari e 28 dipendenti.

DOT NET CORE

.NET Core is a general purpose development platform maintained by Microsoft and the .NET community on GitHub. It is cross-platform, supporting Windows, macOS and Linux, and can be used in device, cloud, and embedded/IoT scenarios.

The following characteristics best define .NET Core:

  • Flexible deployment: Can be included in your app or installed side-by-side user- or machine-wide.

  • Cross-platform: Runs on Windows, macOS and Linux; can be ported to other OSes. The supported Operating Systems (OS), CPUs and application scenarios will grow over time, provided by Microsoft, other companies, and individuals.

  • Command-line tools: All product scenarios can be exercised at the command-line.

  • Compatible: .NET Core is compatible with .NET Framework, Xamarin and Mono, via the .NET Standard Library.

  • Open source: The .NET Core platform is open source, using MIT an Apache 2 licenses. Documentation is licensed under CC-BY. .NET Core is a .NET Foundation project.

  • Supported by Microsoft: .NET Core is supported by Microsoft, per .NET Core Support

More on the Official .NET Core Documentation from Microsoft

Basically, Microsoft built a version of .NET to allow developers to write cross-platform and cloud-optimized applications.

First, .NET is cross-platform. It runs on Windows, macOS and Linux, which allows the developer to share and run the exact same code between machines running different operating systems, with no changes in code and minimum or no changes in the development process. (Watch out for OS specific APIs!)

But the true innovation in .NET came with the modularization in design and architecture. The compiler (Roslyn) and the runtime (CoreCLR) are separate components that allow you to use different implementations (or even write your own).

Every library comes as a NuGet package, so when you start a new project, you don’t have any libraries, but a project file (currently a .json, in the future a .csproj to maintain consistency with all .NET projects) and a Program.cs. As you develop your app, you add libraries as you need them, allowing you to minimize the size of your application.

.NET Core also allows you to have multiple versions installed at the same time without having apps / parts of the OS breaking when you update or install a newer version of the framework, and will even allow you to ship the framework / parts of the framework with the application (since the footprint of the framework si small enough).

Cross Site Scripting

Il cross-site scripting (XSS) è una vulnerabilità che affligge siti web dinamici che impiegano un insufficiente controllo dell'input nei form. Un XSS permette a un cracker di inserire o eseguire codice lato client al fine di attuare un insieme variegato di attacchi quali, ad esempio, raccolta, manipolazione e reindirizzamento di informazioni riservate, visualizzazione e modifica di dati presenti sui server, alterazione del comportamento dinamico delle pagine web, ecc.

Nell'accezione odierna, la tecnica ricomprende l'utilizzo di qualsiasi linguaggio di scripting lato client tra i quali JavaScript, VBScript, Flash. Il loro effetto può variare da un piccolo fastidio a un significativo rischio per la sicurezza, a seconda della sensibilità dei dati trattati nel sito vulnerabile e dalla natura delle strategie di sicurezza implementate dai proprietari del sito web.

anonymous for the voiceless

Anonymous for the Voiceless is an animal rights organisation that specializes in street activism.

Over 4,010 demonstrations in 729 cities WORLDWIDE, we've convinced at least 216,102 bystanders to take veganism seriously.

THROUGH THE USE OF LOCAL STANDARD-PRACTICE FOOTAGE, WE EXPOSE TO THE PUBLIC WHAT IS INTENTIONALLY HIDDEN FROM THEM WHEN IT COMES TO ANIMAL EXPLOITATION. COMBINING THIS WITH A VALUE-BASED SALES APPROACH AND RESOURCE LITERATURE, WE FULLY EQUIP THE PUBLIC WITH EVERYTHING THEY NEED IN SWITCHING TO A VEGAN LIFESTYLE. WE HOLD AN ABOLITIONIST STANCE ON ANIMAL EXPLOITATION.